ambionics / phpggc

PHPGGC is a library of PHP unserialize() payloads along with a tool to generate them, from command line or programmatically.
https://ambionics.io/blog
Apache License 2.0
3.2k stars 492 forks source link

Switch to RFC3986-compliant URL-encoding #189

Closed swapgs closed 3 months ago

swapgs commented 4 months ago

How would you feel about changing urlencode() to rawurlencode() in both the url and soft encoders?

https://github.com/ambionics/phpggc/blob/6ab7c1477bb4b355076da10dc9ddad66aae3f3be/lib/PHPGGC.php#L434-L436

https://github.com/ambionics/phpggc/blob/6ab7c1477bb4b355076da10dc9ddad66aae3f3be/lib/PHPGGC.php#L437-L440

urlencode() has the particularity of encoding spaces to +, which will get correctly decoded in some contexts but not others (e.g. cookies). I don't remember any case where %20 got rejected where a + wouldn't have been, so I assume this is a safe change and this doesn't require introducing a new encoder.

Patch is ready on my side but I just wanted to make sure I was not missing anything before opening the PR.

cfreal commented 3 months ago

Hi!

The only problem is the size, but generally there aren't many spaces in a payload, so I agree. Please submit the PR!

Charles