Skip to content

Commit 1b09258

Browse files
authored
Merge pull request #127 from BishopFox/fix/pmapper-basepath-all-checks
Fix pmapper-data-basepath ignored in all-checks and instances race condition
2 parents c7f81dc + 7727d1d commit 1b09258

3 files changed

Lines changed: 14 additions & 11 deletions

File tree

aws/instances.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,13 @@ func (m *InstancesModule) Instances(filter string, outputDirectory string, verbo
128128
}
129129

130130
wg.Wait()
131-
//time.Sleep(time.Second * 2)
132131

133-
// Perform role analysis
132+
// Signal the receiver to stop and wait for it to finish draining the channel.
133+
// This must happen BEFORE role analysis to ensure all MappedInstances are collected.
134+
receiverDone <- true
135+
<-receiverDone
136+
137+
// Perform role analysis (all instances are now in m.MappedInstances)
134138
if m.pmapperError == nil {
135139
for i := range m.MappedInstances {
136140
m.MappedInstances[i].Admin, m.MappedInstances[i].CanPrivEsc = GetPmapperResults(m.SkipAdminCheck, m.pmapperMod, &m.MappedInstances[i].Role)
@@ -144,8 +148,6 @@ func (m *InstancesModule) Instances(filter string, outputDirectory string, verbo
144148
// Send a message to the spinner goroutine to close the channel and stop
145149
spinnerDone <- true
146150
<-spinnerDone
147-
receiverDone <- true
148-
<-receiverDone
149151

150152
// This conditional block will either dump the userData attribute content or the general instances data, depending on what you select via command line.
151153
//fmt.Printf("\n[*] Preparing output...\n\n")

cli/aws.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2435,12 +2435,13 @@ func runAllChecksCommand(cmd *cobra.Command, args []string) {
24352435
roleTrusts.PrintRoleTrusts(AWSOutputDirectory, Verbosity)
24362436

24372437
pmapperCommand := aws.PmapperModule{
2438-
Caller: *caller,
2439-
AWSProfile: profile,
2440-
Goroutines: Goroutines,
2441-
WrapTable: AWSWrapTable,
2442-
AWSOutputType: AWSOutputType,
2443-
AWSTableCols: AWSTableCols,
2438+
Caller: *caller,
2439+
AWSProfile: profile,
2440+
Goroutines: Goroutines,
2441+
WrapTable: AWSWrapTable,
2442+
AWSOutputType: AWSOutputType,
2443+
AWSTableCols: AWSTableCols,
2444+
PmapperDataBasePath: PmapperDataBasePath,
24442445
}
24452446
pmapperCommand.PrintPmapperData(AWSOutputDirectory, Verbosity)
24462447

globals/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ const CLOUDFOX_USER_AGENT = "cloudfox"
44
const CLOUDFOX_LOG_FILE_DIR_NAME = ".cloudfox"
55
const CLOUDFOX_BASE_DIRECTORY = "cloudfox-output"
66
const LOOT_DIRECTORY_NAME = "loot"
7-
const CLOUDFOX_VERSION = "2.0.3"
7+
const CLOUDFOX_VERSION = "2.0.4"

0 commit comments

Comments
 (0)