Live data from Hacker News

I Went to SQL Injection Court

sockpuppet.org

271–280 of 463 posts

Re: I Went to SQL Injection Court

#271
post #48
post #14

Earlier quoted context omitted.

“Never doubt that a small group of thoughtful, committed citizens can change the world: indeed, it's the only thing that ever has.” - Margaret Mead

Like a hedge fund? Or are we including those committed to violence?

Snipers, patient 0's, drunk drivers...

Re: I Went to SQL Injection Court

#272

> You also generally can't FOIA the source code of programs they run. Alas, that part should be illegal under FOIA. Source code should be open source and verifiable . Being exempt from FOIA circumvents public confidence in the government's use of software. I'd be curious to learn if/where courts have decided such things already.

I assume that - even though there's a strong public interest argument for it - government orgs are prone to blanket banning the release of source code, for the same primary reason that businesses are prone to doing so. That is, too high a chance of sensitive data (passwords, tokens, IP addresses, etc) being hard-coded in all-too-often non-12-factor-aspiring code; and too much security / liability headache if said sensitive data gets out.

There's probably also some actual business logic that government orgs want to and are legally permitted to keep secret. In the OP's case of a parking ticket database, maybe there's software talking to that database, whose source code includes the logic of picking when / where parking inspectors should conduct a "random" blitz of issuing fines.

Re: I Went to SQL Injection Court

#274

Earlier quoted context omitted.

You can always `SELECT table_name, column_name, data_type FROM information_schema.columns`, which is part of the SQL standard. https://www.postgresql.org/docs/current/infoschema-columns.h... Plus, generally if you have SQL injection, you have multiple tries. You're not going to be locked out after one shot. And there's only so many combinations of `SELECT {id,userid,user_id,uid} FROM {user,users,login,logins,customer…

That's a good point, has anyone hardened a database by locking out users who select columns that don't exist? Or run other dubious queries? This would obviously interrupt production but if someone is running queries on your db it's probably worth it?

Zane Lackey (with Dan Kaminsky) gave a talk that discussed doing literally that sort of things, back in 2013. Zane went on to found Signal Sciences (acquired by Fastly), doing this sort of stuff in the 'WAF' space.

https://youtu.be/jQblKuMuS0Y?t=866 (timestamp is when Zane starts talking about it)

Re: I Went to SQL Injection Court

#275

When a law is ambiguous by wording, why do they never ask the people who drafted the law what was intended?

That would be against the separation of powers doctrine inherent in all Western democracies. The job of the legislature is to write the law. The job of the judiciary is to interpret the law.

Besides, when the law is ambiguous, it's very often because the legislature themselves weren't sure what they intended, and/or because the legislature had deeply divided views and arrived at ambiguous wording as a compromise, and/or because the legislature used their "somebody else's problem" prerogative i.e. they said "let's leave that for the courts to decide". Ambiguously worded laws isn't a bug, it's a feature!

Re: I Went to SQL Injection Court

#276

Am I the only one slightly perplexed/worried by the point-blank source code exemption? It's easy to imagine a scenario where the city decides to develop a specific software in-house and hide the "biases" in the source code, or any other thing one might not find desirable. Hell, they don't even need to make everything from scratch! Could just patch and use a permissively licensed 3rd-party component. In my opinion, th…

In theory the decision to put those biases in the code should be public information. You can ask for the criteria the software was made to, just not the software itself. Though rulings like this might have a chilling effect.

Only if they are written down. For instance, DOGE makes sure everything is done by voice so there is nothing to catch them out on in future. I've found that once you start hitting a public body with FOIAs regularly they learn to stop putting incriminating things down in writing.

Re: I Went to SQL Injection Court

#277
post #42

Earlier quoted context omitted.

Yep, that was done in the FOIA request related to this lawsuit: select utc.column_name as colname, uo.object_name as tablename, utc.data_type as type from user_objects uo join user_tab_columns utc on uo.object_name = utc.table_name where uo.object_type = 'TABLE' https://www.muckrock.com/foi/chicago-169/canvas-database-sch...

Yeah, it's obvious the double standard here, then. Curious indeed why they are so adamant to keep the schema/data secret.

Public bodies tend to just want to resist FOIAs for the sake of resisting them. I've never really been able to fully understand the motivations, even after a decade of FOIA litigation.

Re: I Went to SQL Injection Court

#278
post #143

Earlier quoted context omitted.

Well that certainly sounds suspicious. But it could also provide more damming evidence of targeting groups, people skimming the till, bribes to make tickets go away, all sort of fun shenanigans. And boy they’re fighting suspiciously hard. Good luck.

Bribes are most certainly not logged in the system under the "bribes" column or codified in any way. The data discovered through foi could show some patterns which are suggestive of bribes, but the actual thing is negotiated "off chain".

That’s what I meant. For example, people who have a suspicious number of tickets dismissed. Or perhaps certain employees that dismiss a suspicious number.

Re: I Went to SQL Injection Court

#279
post #98

Interesting takeaways from me: All that pompous sounding legalese can still be ambiguous! I feel less bad for not understanding contracts that have 100 word compound sentences. Legal people can't keep up with our tech jargon but they have their own jargon including "predicate" lol. So same logical thinking, different jargon framework. Question: why do they want the schema not the data?

Because once you have the schema you can issue FOIA requests that include queries for them to run.

Oh wow! If that is necessary, that is so kafkaesque!

"I want your data"

"What data?"

"What do you have?"

"Ha ha. No. Tell me what you want"

"Your data that is the metadata of your data"

"Well actually..."

...

Re: I Went to SQL Injection Court

#280

Earlier quoted context omitted.

On the surface that’s a very attractive idea. A sort of “you shouldn’t be in here, even if we left the door unlocked.”

So if you deploy code before you run the associated db migration, or misspell a column name, you magnify the impact from whichever code paths (& application tier nodes) are running the broken SQL, to your entire production environment.

Yeah it's definitely something that could do more harm than good to a company long term. But I'm sure there are instances where this tradeoff is worth it. They would invest more heavily in runbooks or maybe even ci that runs migrations on deploy. Deleting columns would need to be done on your deploy + 1. Probably no rollback at all.
Post reply on HN