News for hackers. Stuff that matters.
Re:Eval($_POST[cmd]) by krapp on Wednesday May 20, 2015 @11:19AM (#9576885)
Yet more abuse of $_POST in PHP. The language should taint user supplied data by default so this wouldn't even run without throwing an exception, at the very least.

Why does eval() exist in so many programming languages, and when is using it not the worst possible option?

Re:Eval($_POST[cmd]) by notacoward on Wednesday May 20, 2015 @12:59PM (#9577619)
It's not the worst possible option when you want to wrap a command you yourself wrote in some extra stuff. For example, in a test script, you might pass the command to a function that

(1) Prints some info about the test that's about to execute

(2) Evals the command

(3) Checks/reports the result

Given the choice I'd rather use lambda, but not all languages make that very convenient/readable. In such languages, a carefully used eval might be preferable to ad-hoc interpretation.

Re:Eval($_POST[cmd]) by krapp on Wednesday May 20, 2015 @08:26PM (#9580287)
Fair enough. Although even then I would consider using a function or a class or lambda first, I suppose as long as you completely control the code being evaled it's not fundamentally different than any other string or code on the server. It would still fill me with a gnawing sense of dread though.
Re:Eval($_POST[cmd]) by DrinkWater on Wednesday May 20, 2015 @10:34AM (#9576569)
So what? What is the point of this? Is this again one of these "php developers are 'special' people"-posts?
Re:Eval($_POST[cmd]) by brevis on Wednesday May 20, 2015 @10:44AM (#9576641)
I hope it will make people once again check their code.
Re:Eval($_POST[cmd]) by jayzalowitz on Wednesday May 20, 2015 @10:40AM (#9576601)
Also, one could argue that if you lock down servers properly, something like this could be used for instruction passing between servers/datacenters/etc... its not a good argument, but its a way of doing things.
Re:Eval($_POST[cmd]) by timboslice on Wednesday May 20, 2015 @10:40AM (#9576600)
I'm guessing he's just showing us the dork (search phrase) to find these vulns and outline how stupid... errr special people can be
Re:Eval($_POST[cmd]) by agumonkey on Wednesday May 20, 2015 @10:43AM (#9576633)
Some things are utterly weird. A jpg file with php code is not idiocy, it's either security learning or plain hackery. Reminds me of my beloved wordpress days.