4 ms·
> In our experience, when you use a hardened data library such as TrustedSqlString (see “SQL Injection Vulnerabilities: TrustedSqlString” on page 252) That is
by DeathArrow 7y ago
> In our experience,
when you use a hardened data library such as TrustedSqlString (see “SQL Injection
Vulnerabilities: TrustedSqlString” on page 252)
That is not my experience. Yes, the most simple SQL injection a newbie attacker would try, is running a query directly on your database using stuff like" ' OR '1' =='1' "
However, one can do a lot of other things like getting the schema, table names and the actual data in the tables by observing the answers and timing. When I did my master's degree, on the course about database security the teacher said there isn't any mean to 100% prevent SQL injection.
There are other means to protect data, like not using a single app user to access the database, use security rules at database level together with security rules at app level.
One clever trick is to return fake data if you detect a smart ass is trying to access data he shouldn't, rather then tell him he is forbidden. Let him enjoy his fake data. :)
- onion2k 7y agoOne clever trick is to return fake data if you detect a smart ass is trying to access data he shouldn't, rather then tell him he is forbidden. Let him enjoy his fake data. :) That sounds like a lot of effort for something that should never happen if your real security systems are working, and a huge problem if something breaks and returns fake data to real users. It would look like their accounts have been compromised which is far worse for the business than any amount of enjoyment you might get messing with an attacker. Honeypots are useful in some very specific situations, but you need to be really careful where and how you implement them. Generally, leave them to the network security team. In my experience anything you do that tries to be 'clever' is a bad idea. Implement the simplest possible solution that solves the problem, otherwise it's going to blow up in your face one day.
- tziki 7y agoIt's also a big problem if the hack gained any publicity. Who's actually going to believe "no no, it was actually fake data that got stolen"?
- DeathArrow 7y agoIt's not about making the attacker think the data is valid. It's about not letting him know whether the data is valid or not.
- onion2k 7y agoIf the attacker doesn't know then no one will know, so when the dump gets uploaded to pastebin with the title "10,000 records from <your service>" and that gets reported in The Register everyone will believe it's a real breach. You would then be in the position where you have to persuade the public it isn't. That would be very difficult because no one would know whether the data is valid or not. If that's the strategy you want to use that's up to you, but I think it's immensely risky and provides no practical benefit.
- jldugger 7y ago> mean to 100% prevent SQL injection I'm curious what sort of injection gets past parameterized queries they talk about in your master's degree.
- danielbarla 7y agoMy guess would be that this was a mis-quote, probably meant to be "there's no way to 100% prevent SQL injection via sanitization". Possibly followed by advice to use parametrized queries. Alternatively, the lecturer could have just been wrong. If someone does have a counter example for parametrized queries, I'd be curious.
- DeathArrow 7y agoThat's right, that's what I wanted to say.