News for hackers. Stuff that matters.
Re:SQL Injection through HTTP Headers by elchief on Wednesday April 04, 2012 @01:24AM (#3796307)
If using PHP, use PDO and always use parameters.

Use HTMLPurifier to avoid xss.

You still need to be careful if building queries dynamically, such as dynamic WHERE or ORDER by clauses.

Re:SQL Injection through HTTP Headers by antihero on Wednesday April 04, 2012 @04:25AM (#3796664)
I'd take that one step further and use an ORM like Doctrine, because otherwise doing trivial stuff is completely annoying. If you don't use an ORM package you quickly start writing your own ORM anyway.
Re:SQL Injection through HTTP Headers by elchief on Wednesday April 04, 2012 @01:37PM (#3798738)
Agreed, but even some ORMs (like Yii's ActiveRecord) don't validate the field name in the WHERE part in certain functions.
Re:SQL Injection through HTTP Headers by Jebus on Wednesday April 04, 2012 @05:08AM (#3796768)
HTMLPurifier? That thing should only be used if you are accepting html as input (eg: wysiwyg). Just escape everything in the view layer (not in the DBAL. There you only escape to avoid sql injection, not XSS!)
Re:SQL Injection through HTTP Headers by elchief on Wednesday April 04, 2012 @01:40PM (#3798762)
what if someone puts html in a plain old text field?

your db should never contain xss material. some jackass will forget to escape it on display.

Re:SQL Injection through HTTP Headers by Jebus on Wednesday April 04, 2012 @03:12PM (#3799291)
The thing is, you can't just 'escape XSS'. You need to know exactly where the data is going to be used, and you can't know that when you store it (in fact, you could use the same data in many different places). There are infinite ways of doing XSS, so if you don't escape properly, you are still vulnerable. The view layer should escape everything by default. Then if you need a different filter, or disable escaping (for wysiwyg for instance), do it manually.
Re:SQL Injection through HTTP Headers by elchief on Thursday April 05, 2012 @02:04AM (#3801509)
but how often is someone's username <script>stealMahCookeez()</script> ?