14
hjk101
6y

I have quite a few of these so I'm doing a series.
(2 of 3) Flexi Lexi

A backend developer was tired of building data for the templates. So he created a macro/filter for our in house template lexer. This filter allowed the web designers (didn't really call them frond end devs yet back then) could just at an SQL statement in the templates.

The macro had no safe argument parsing and the designers knew basic SQL but did not know about SQL Injection and used string concatination to insert all kinds of user and request data in the queries.
Two months after this novel feature was introduced we had SQL injections all over the place when some piece of input was missing but worse the whole product was riddled with SQLi vulnerabilities.

Comments
  • 0
  • 0
  • 1
    Letting the template layer run SQL is one of those features that must have felt like a productivity breakthrough for roughly six weeks.

    The detail that really stings is "the designers knew basic SQL but not injection" - they were handed a loaded footgun and told it was a filter, so of course they concatenated request data into it. That failure mode is why the little templating helper I ended up writing (str_template) does exactly one thing: substitute {placeholders} into a string. No logic, no data access, deliberately too boring to ever become an incident report.
Add Comment