cloudfox: Go Panic during all-checks
Description of Bug
When running cloudfox aws all-checks the program crashes during the privesc phase with:
[resource-trusts][666412488974-AIDAJBTEDJEDFGHJKLWJU] Supported Services: CodeBuild, ECR, EFS, Glue, Lambda, SecretsManager, S3, SNS, SQS
failed to get shared config profile, 116412344578-AIDAJBTEDJEDFGHJKLWJU
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x101022724]
goroutine 9981 [running]:
github.com/BishopFox/cloudfox/internal.AWSConfigFileLoader({_, _}, {_, _}, {_, _})
github.com/BishopFox/cloudfox/internal/aws.go:67 +0x3e4
github.com/BishopFox/cloudfox/aws.initCloudFoxS3Client({_, _, _, {_}, {}}, {_, _}, {_, _}, {_, ...})
github.com/BishopFox/cloudfox/aws/client-initializers.go:48 +0x80
github.com/BishopFox/cloudfox/aws.(*ResourceTrustsModule).getS3Buckets(0x140011a4580, 0x100157644?, 0x14002196660, 0x140006733f0?)
github.com/BishopFox/cloudfox/aws/resource-trusts.go:371 +0x114
created by github.com/BishopFox/cloudfox/aws.(*ResourceTrustsModule).PrintResources in goroutine 1
github.com/BishopFox/cloudfox/aws/resource-trusts.go:94 +0x8c8
What should the expected behavior be
Not crash
Platform Affected
macOS Darwin 21.6.0 ARM64 (macOS Monterey)
Steps to Reproduce
- Install via
brew - Use
aws-vaultto start an authenticated shell with STS credentials - Run
cloudfox aws all-checks
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 15 (8 by maintainers)
Commits related to this issue
- Hopefully this is a fix for #72 — committed to BishopFox/cloudfox by sethsec-bf 3 years ago
- This potential fix for #72 makes a lot more sense. Rather than overrwite the profile attribute of the struct, i have an AWSProfileProvided and a AWSProfileFake so that I can just pass the orig to othe... — committed to BishopFox/cloudfox by sethsec-bf 3 years ago
- Fix for sub issue found by @cyberbutler in #72 — committed to BishopFox/cloudfox by sethsec-bf 3 years ago
- More fixes from #72. Took the suggestion from @johnkeates and fixed the prepopulated nmap commands to NOT include a profile for the cases where the user did not specify a profile for cloudfox — committed to BishopFox/cloudfox by sethsec-bf 3 years ago
Hey @cyberbutler - I understand if you don’t have access anymore, but if you do, can you check out and try the latest. you actually found a completely unrelated bug lol, but i think i fixed it!
Also, thank you so much for taking the time to chime in and report the other bug!
Just commenting here that the patch in
seth-devdid not fix the issue for me. I noticed that @johnkeates ranrole-trustscommand above and notresource-trustsso i’m wondering if the issue is actually resolved on their side as well. Funny thing for me is that manually runningresource-trustsworked, but not when it got to the point inall-checks. Sorry, I won’t be able to help debug any further, just wanted to include my two cents if it enabled @johnkeates to help further.I found another teeny tiny related issue, pmapper expects the same profile as cloud fox, so when you run the suggested pmapper command it wouldn’t be able to find the same profile as the temporarily created profile name because… well it’s temporary isn’t it 😁
Looking at pmapper a bit more, it seems to be able to create a graph with non-profile commands, but I don’t know if it will store the graph values somewhere in a known location vs. how it stores the data in Cloudfox. Maybe it’s not a big deal since the pmapper data is available outside of Cloudfox anyway.
I’ll check it out!
Works 👍 (edited for brevity)
Using a classic (and also via a passthrough credential_process) profile everything works as expected, so that’s good to know.
During a copy-paste mistake I got this interesting (unrelated) panic:
I could create an issue for that, but I suspect most people can figure out why the panic happens in the first place.