Monolog/RCE11: FingersCrossedHandler processors chain (3.0.0–3.10.0+)&PHP 8.4.16#230
Monolog/RCE11: FingersCrossedHandler processors chain (3.0.0–3.10.0+)&PHP 8.4.16#230Fractlord wants to merge 1 commit into
Conversation
|
Hello @Fractlord , I'm mirhossein, the author of Monolog/RCE8,9. You referred to RCE8 and RCE9, and as a result I will provide explanations on several topics.
RCE8 and RCE9 work on 3.0.0-3.10.0+
RCE8 is based on This GC is exactly similar to Monolog/RCE9. I removed unnecessary properties to keep the payload smaller. Also, please take a look at this PR. I had renamed Please remove Respectfully, I think this GC is a duplicate of Monolog/RCE9. If you think I’m wrong, please let me know. Good luck. |
|
Hello @mir-hossein , thank you for your message as i really appreciate it. First, I want to say I have a lot of respect for you as the author of the earlier Monolog chains as they were part of what motivated me to contribute here, so thank you for that. You are correct this is not a new gadget family. It follows the same RCE9-style approach (the same handler and the same get_object_vars → end → function-call idea). My goal was not to invent a different primitive. It came from testing on Monolog 3.9 in a real production environment. The payloads produced by stock PHPGGC RCE8/RCE9 did not work for me, whereas a generator that stores the command in formatted and matches Monolog 3.9’s LogRecord field layout did. That lines up with what you said about $mixed vs $formatted, and with PR #218 not being merged , I had not seen that PR when I opened mine. Even if #218 had already been merged, I would still point out one intentional difference, in my opinion, the builder mentioned here is more verbose because it tries to mirror Monolog 3.9’s structure much more closely. That can help on pickier runtimes (for example PHP 8.x + Monolog 3.9’s LogRecord), where a minimal stub might fail at the cost of a larger serialized payload.(That trade-off mattered less for my target than reliability.) I’m happy to align with whatever the maintainers prefer , for example closing this in favour of fixing/extending RCE9 once #218 lands, or adjusting the PR based on your guidance.(that line should indeed be removed). |
|
Hello, Thank you for your explanation. I just wanted to provide some clarification. I think, current Monolog/RCE9 failed on your target because they had set a custom error handler. (something regular in Frameworks and ...) I guess, the deprecation triggered the error handler and the handler stopped the execution. It's the reason that current RCE9 failed on your target. I expect #218 to solve the problem. I tested #218 Monolog/RCE9 on (PHP 8.4.18 + Monolog 3.9) and worked for me. Also, I tested for error handler presence, older (current) RCE9 failed but #218 RCE9 worked. About removing unnecessary properties: Current PHP engines allow us to use uninitialized properties and also, according to the maintainers' recommendations.
EDIT is required: (parameters -> properties) Their recommendation is conditional but works even if a property doesn't have a default value. I haven't seen any reports of gadgets failing due to default values in the past years, but I'm NOT sure about later versions of PHP. I agree with you that in most cases, reliability is more important than payload size. The internet has been cut off by the government in Iran for about two months, netblocks report, and my limited access to the internet is unstable. I will probably no longer have access to GitHub, Gmail and etc. I wish the best for the maintainers, contributors, and you. Regards |
Key properties
phpggcbecomes the final processor. Works withsystem,exec,passthru,shell_exec, or any callable accepting a single string.FingersCrossedHandler,LogRecord,Levelenum).readonly-safe property initialization via__constructstubs.Compatibility matrix
Tested with
test-gc-compatibility.pyon PHP 8.4.16:--test-payload:SUCCESS: Payload triggered !Difference from existing Monolog 3.x chains
3.0.0–3.1.0and rely onSyslogUdpHandler/BufferHandler+ProcessHandler.FingersCrossedHandler's processor loop, with no reliance on handlers that were refactored or removed in later 3.x releases.Usage