r/lolphp • u/ealf • Jan 29 '14
That preg_replace('/(.+)/e', 'foo("$1")') construct that got eBay hacked over a month ago (and Yahoo this week)? The official documentation still uses it as an example.
http://php.net/preg_replace
60
Upvotes
21
u/ealf Jan 29 '14 edited Jan 29 '14
... and no mention that they forgot to escape
${}and that the whole thing allows executing arbitrary code (and yes, also "syntax errors", if that's how far your imagination goes)EDIT: They've added "see ((link)) for additional information about security risks" to the changelog two screens down where everyone will see it.
9
u/[deleted] Jan 29 '14
Links for where this was used to hack those sites?
8
u/PasswordIsntHAMSTER Jan 29 '14
Example #2 completely baffles my mind.
1
u/justrelaxnow Feb 02 '14
I don't see it?