fortra / No-Consolation

A BOF that runs unmanaged PEs inline
https://www.coresecurity.com/core-labs/articles/running-pes-inline-without-console
MIT License
548 stars 64 forks source link

"--free-libraries" aggressor script option parsing errors #3

Closed Billith closed 4 weeks ago

Billith commented 1 month ago

Recent changes introduced problem with aggressor script arguments parsing. Running simple example cause following error: Screenshot 2024-10-14 210106

Tested current version of No-Consolation (commit 44784d6578c61e65f43cf2f2e0bf52dc22b8e963) on Cobalt Strike 4.10. Reverting to commit f791d277aa843c15047d290c1ba00d2bdfcbb950 solves the issue.

Cerbersec commented 1 month ago

The issue here is $free_libs is initially declared as $free_libs = 0; and then evaluated by strlen($free_libs); to determine if it's set or not. However, strlen($free_libs); never equals 0 because it's treated as a string: $free_libs = "0" with a length of 1.

A solution could be to declare as empty string $free_libs = ""; or use proper comparison operators if($free_libs == 0 || $free_libs != 0)