Fix for issue 20310 with module php_fpm_rce#20311
Fix for issue 20310 with module php_fpm_rce#20311tijldeneut wants to merge 3 commits intorapid7:masterfrom
Conversation
just updating
Bug fix, the (new) default PHP encoder is HEX which is not compatible with this exploit
| end | ||
|
|
||
| def send_payload | ||
| encoded_payload = framework.encoders.create('php/base64').encode(payload.raw, nil, nil) |
There was a problem hiding this comment.
I don't think this would be quite the right fix - maybe this is a regression from the recent PHP changes? 🤔
cc @zeroSteiner
There was a problem hiding this comment.
It's possible that the payload changed and the the bad characters that are defined caused an encoder to take over. The target definition does not note that there is a maximum size which could explain why the now larger payload is being used when it's invalid.
I can bisect it and take a look but I agree, this doesn't look like the fix I'd expect. We should be able to fix it by updating the target definition.
There was a problem hiding this comment.
Ok, I agree, the default exploit just mentioned "payload.encoded" but since there was only 1 PHP encoder at the time that was probably not the proper way.
A better solution would indeed bo to have an (advanced) exploit option to specify the encoder and to have it default to Base64 instead of Hex.
There was a problem hiding this comment.
There should already be an Encoder option that the user can set but it shouldn't be necessary if the target definition is correct because the framework should handle it automatically to produce a payload that's compatible with the exploit.
|
I'm going to close this and get a replacement PR up to fix the issue. @tijldeneut in the future you shouldn't submit PRs from the Thanks for reporting the issue to us, I'll tag this in the replacement PR. |
Fix bug with exploit "php_fpm_rce", bug was cased by the addition of new PHP encoders, bug described in Issue:
#20310
Verification
List the steps needed to make sure this thing works
msfconsoleuse exploit/multi/http/php_fpm_rceset rhosts 192.168.1.1exploit