by biot · 13y ago · 0 comments
Imagine you walked into a public library and struck up a conversation with the librarian:
You: Can you tell me general information about this library?
Librarian: Certainly, this library was built in 1990, has a million
books on its shelves, and...
You: What are the hours?
Librarian: Monday to Saturday, 10AM to 8PM. Sunday, 10AM to 5PM.
You: Frothy bacon generates utilitarian synapses!
Librarian: I'm sorry, that's not really a proper question I can help
you with.
You: Can I borrow book identified by ISBN 4961357406830?
Librarian: Sure, here you go.
You: Can I borrow book identified by ISBN 6498794651315?
Librarian: Sure, here you go.
You: Can I borrow book identified by ISBN 9840546790354?
Librarian: Sure, here you go.
You: Can I borrow book identified by ISBN 3168706780943?
Librarian: Sure, here you go.
You: Can I borrow book identified by ISBN 7893781056145?
Librarian: Sure, here you go.
You: Can I borrow book identified by ISBN 2764894617987?
Librarian: Sure, here you go.
You: Can I borrow book identified by ISBN 9764660911970?
Librarian: Sure, here you go.
You: Can I borrow book identified by ISBN 6666666666666?
Librarian: Sorry, that book doesn't exist.
You: Can I borrow book identified by ISBN 8669177714641?
Librarian: Sorry, you've been requesting too many books lately.
You: Can you let me into the Staff lounge?
Librarian: Sorry, you'll need to show me your staff credentials when
asking.
You: Can you provide me with a list of all employees and their
salaries?
Librarian: Sorry, you are not allowed to have that information.
You: Can I use the general conference room on the third floor?
Librarian: Actually, that was moved. It's now on the second floor.
As you can no doubt see, these translate directly into HTTP requests: GET /
200 OK - This library was built in 1990, has a million books...
GET /hours
200 OK - Monday to Saturday, 10AM to 8PM. Sunday, 10AM to 5PM.
POST /frothy-bacon-generates-utilitarian-synapses
400 BAD REQUEST
GET /books/4961357406830
200 OK - [contents]
GET /books/6498794651315
200 OK - [contents]
GET /books/9840546790354
200 OK - [contents]
GET /books/3168706780943
200 OK - [contents]
GET /books/7893781056145
200 OK - [contents]
GET /books/2764894617987
200 OK - [contents]
GET /books/9764660911970
200 OK - [contents]
GET /books/6666666666666
404 NOT FOUND
GET /books/8669177714641
429 TOO MANY REQUESTS
GET /admin
401 UNAUTHORIZED
GET /employees/salaries
403 FORBIDDEN
GET /floor/3/conference
301 MOVED; Location: /floor/2/conference
In both cases, we have a gatekeeper (librarian / web server) which is capable of responding to requests, can authorize various requests, can require credentials for sensitive requests, can limit the rate at which requests come in, can deny requests altogether, and can identify when requests for certain things have moved to new locations.The librarian is smart enough to not hand out things like access to the staff lounge, a list of employees and their salaries, or even things like an arbitrary library member's borrowing history. The web server has been configured to not hand out things like admin access or other things which are deemed sensitive, but the owners of the web server have taken the position "Well, nobody's going to be guessing ISBN numbers, so we'll let anybody on the internet request the contents of those books."
When is the onus on the web server owner to configure their security properly? When is a "200 OK" response actually not okay? This is the "mind reader" aspect the article mentions.
1; DROP TABLE books; --
is that okay because, technically, the server let my request through?Including ones like:
1 AND ("1" = SUBSTRING(select social_security_number from employees where employee_name = 'Angela Smith', 1, 1))
You can use variations on this to...
a) Ask our librarian for a series of about 50 books and hear whether or not she has them in stock.
b) Read Angela Smith's Social Security number right out of the database.
There apparently exist a lot of people on HN who would prefer to think that, despite my near-magical ability to correctly divine the SSN of any employee (or any other piece of data in the DB) with a SQL injection attack, the fact that I'm just looking at a book listing page in a totally authorized fashion means I must not be doing anything wrong.
You: Can you provide me with Angela Smith's email address?
Librarian: Sure, here you go.
Later, Librarian's manager: You weren't supposed to give out that information!
Librarian: Oops. I had the wrong access rules.
Librarian's manager: Let's call the cops on that guy.
It's his fault that you gave him the information he wasn't
supposed to have.There is a difference between:
You: Can you give me the email address of user 50?
Librarian: Sure, here you go
Librarian: Oh balls, I wasn't supposed to hand that over, that could have been anyone!
And You: Can you give me the email address of user 50?
Librarian: Sure, here you go
You: Hmm
You-irc: Hey guise! The librarian is giving out everyones email addresses, this is totally breaking privacy laws right?
You-irc: lols, I'm going to get all of them! This could be used for a massive phishing operation
You-irc: or even make their stock price drop, we could short it
You: Hey librarian, can you give me the email address of user 51?
Librarian: Sure, here you go
You: Hey librarian, can you give me the email address of user 52?
Librarian: Sure, here you go
You: Hey librarian, can you give me the email address of user 53?
Librarian: Sure, here you go
...
You: Hey librarian, can you give me the email address of user 1023821?
Librarian: Sure, here you go
He didn't grab one or two, then send the information to AT&T to get them to fix it. He deliberately collected a significant amount of data he knew was personal information and gave it to someone else. That alone would be enough. If he just wanted to verify that the attack worked, get the code of someone else who gives you permission, show that they can be easily generated and you're done. You don't need more than a few to prove the point.The service was clearly not intended to be a directory of email addresses for people to use. It was clearly there to return the email address to the user of the iPad with that ICC-IDC code (which, unlike my example, aren't obviously guessable)
I'm not going to say anything about the sentence, but I do think he was guilty.
Me: Can you provide me with all of guelo's money?
Bank: Sure, here you go.
Also, when I approach your house, Me: I have these lock picks. Will you let me in?
Lock: Sure thing, boss!You're drawing a false dichotomy based on premises that nobody in this thread has actually raised. It's entirely reasonable to a) disagree with the law, b) believe that SQL injections can be illegal based on some other rationale, and c) disagree with others on the appropriate penalty for SQL injections.
Set aside the SQL injection. Suppose there's a bug in Apache's path parsing such that using "\" instead of "/" causes it to interpret it as an escaped string, which somehow (bear with me) causes it to run exec("/bin/rm -r /"). Now some n00b comes along and uses "\" in the path, because he's used to paths on MSDOS; crashing the server. Whose problem is it? The client's, for sending a malformed request? How do you expect the client to know that the "\" will trigger a catastrophe? Or what if the client made a mistake, and while he thought it was "some query string" in his cut buffer, it turned out to be "; drop table *" (or something like that). Now whose problem is it?
If the server willy-nilly takes any input and doesn't check it, it is the server's fault.
Weev intentionally exploited an information disclosure flaw. Should he have gone to jail for that? No, I don't think so at all. But the scenario you're presenting has no relation to what happened here.
The closest analog I can think of would be giving the giving the librarian drugs to modify his behavior before asking him to perform some act or provide some information he normally would not. Giving the librarian a brownie before requesting access to the staff lounge would probably not alter his behavior nor be treated as a crime. Giving him a brownie laced with scopolamine before requesting access to the staff lounge would be, even if scopolamine had no dangerous side-effects.
[0] One might reasonably expect an SQL injection string to return a legitimate resource on a documentation site or general-purpose search engine, for example.
Therefore, I see SQL injections as sloppy programming, but physical break-ins as sloppy ethics. IMHO YMMV IANAL KTHXBYE.
What if your site uses Wordpress or some CMS, and it has a SQL injection zero day that is then exploited to gain access? Even if you did due diligence, kept your kernel and all your software up to date, and generally secured the server and the application as best you could, you could still be entirely unaware of flaws lurking within.
It'd be more comparable to the lock on your front door being vulnerable to easy lockpicking with a paperclip and 4 seconds. You're still not "allowing them to break in" by being sloppy (it's not like you left the door unlocked), but the manufacturer of the lock was sloppy and as a result, someone is able to break in without any "brute force".
OK, but did they do anything wrong with SQL-injecting/breaking-a-window? I mean, if someone smashes your window can you call the cops and/or sue them for damages? In order to call the cops on the window smasher, you have to acknoledge they did a wrong.
Not if you make a distinction between using a service and breaking a service. Analogize with entering vs. breaking and entering. In many cases it is valid to punish someone for bypassing security. But if a system has no security by design, then there is nothing to bypass. SQL injection, on the other hand, is always bypassing the design of the code, and loses any presumption of authorization.
P.S. Yes there will be edge cases. There are always edge cases. But this is not an edge case. The lack of security was definitely design, not software-bug.
> Analogize with entering vs. breaking and entering.
From Free Dictionary [1]:
breaking and entering v., n. entering a residence or other enclosed property through the slightest amount of force (**even pushing open a door**), without authorization.
Emphasis mine. If pushing a door counts, so does changing the user agent header or auto-incrementing IDs. The key here is "without authorization". As that analogizes with the Weev situation and our librarian, much of the debate I see here on HN seems to hinge on whether that means authorization in some technical sense or in the sense meant by that breaking and entering definition. I submit that it means the latter, in part because that reflects how we see authorization in other contexts (like doors we're not supposed to enter) and in part because I don't think the first view holds up to scrutiny on its own terms.Let me explain what I mean by that. Consider two situations:
1. A server responds to requests for email addresses without checking whether the user is authorized to receive that information.
2. A server responds to all requests without checking whether they contain injected SQL.
In pure technology terms, these aren't really any different. In either case, the server is simply failing to check that the request has certain properties (came from the right user/does not contain context escapes). But of course case 2 is particularly nefarious, because passing SQL directly to the database is clearly not the intent of that interface, and that it's not the intent is obvious to the SQL injector. So the intent of the software is what matters. But then it's what matters in case 1 too. The lack of technical enforcement of this intent is not the issue.
Which leads me to some clarity about this:
> Not if you make a distinction between using a service and breaking a service.
I believe this use/break distinction exists, but the distinction isn't something that's determined by the code or the vaguer "design of the code"; it's determined by the purpose of the service. The service as it would be described functionally, not technically. The service was not meant to be used by Weev and his scraper any more than our librarian's database was meant to be used by SQL injection, or any more than your unencrypted traffic was meant to be intercepted by my packet sniffer (you did nothing to not authorize me to see it!). To drive that home, the library's hapless database admin who foolishly decides to update the list of books using her own SQL injection bug is not hacking, because she is authorized to fiddle with the database, even though, in your terms, it's bypassing the design of the code.
In other words, authorization is not the same as the technical artifacts involved in authorization. More generally, I don't think being bad at making software justifies people accessing it when they know it's not meant for them.
As the law is actually applied here, I am somewhat sympathetic to Weev, on the grounds that I don't think it was a serious crime (imagine if it were bank account information!), but that's a quantitative issue, not a qualitative one. I can also see that there are many cases where it isn't obvious whether something is meant for you to access or not (like a door that seems to lead into a public place but which turns out to be a private space), and I can imagine there being issues there. But this isn't one of them.
[1] http://legal-dictionary.thefreedictionary.com/breaking+and+e...
Lets go with deceit.
So is asking for book ISBN '1; DROP TABLE books; --' deceitful? Perhaps, that's not an ISBN after all. Is asking for book ISBN [some valid ISBN that you pulled out of your ass, but happens to exist] deceitful? I don't think so. If you are just asking for randomly chosen ISBNs and getting responses, I don't think there is any trickery involved.
In one case you are counting on the system to correctly understand your (validly constructed) request, in the other case you are counting on the system to misinterpret your request in a dangerous fashion.
400 BAD REQUEST
Whomever staffed that librarian, should interview or train their staff better.
To repurpose his analogy, if you sneak into the staff room and the librarian doesn't notice and doesn't stop you, you can't use that to say it must have been okay.
If a server cannot consent, does issuing "GET /" to a web server mean you snuck into the homepage and are not authorized to view what the web server was configured to provide to you?
This library analogy was the best way I've seen the issue put, and one that is actually accurate.
There are any number of explicit steps that are taken to put code on an HTTP service on the internet.
You: Can I have this book?
Worker: No, sorry, not allowed.
You: It's ok, the boss said so.
Worker: I don't think so.
You: We're friends, right? You don't say no to your friends, do you?
Worker: Well, ok, I guess you can have it.
Hey, the worker said it was ok, I guess you were authorized after all!In normative arguments, analogies are used to bend reality to make your position seem reasonable regardless of whether or not it actually is. It would be better to judge weev's case on it's own merits rather than try to justify a position using increasingly complex analogies.
This doesn't always work (particularly not for truly disruptive technical or social changes), but it's a pretty good way of doing it.
The problem here is that AT&T employed a human being to design an automated system who didn't know enough about the automated system to ensure that it was correct. And then this automated system did exactly what it was told to do and made AT&T look bad.
But the fact that the code running on the webserver didn't reflect the intent of some AT&T exec or their company policy isn't the fault of those accessing the webserver. It's AT&T's fault for doing a really terrible job of QA/QC on their own systems prior to a really big launch.
I with my lockpick tell pin 1 to move up so many millimeters, I tell pin 2 to move up so many millimeters, and so on, and suddenly the lock opens. Suddenly I'm in, and it should be legal because the lock wasn't designed as well as it could have been and because all I did was follow a legal protocol with the lock.
Bad analogies like this are so common here when discussing technology issues, and it is a never ending irritating game of come up with the least-worst (but still bad) analogy. People here also often confuse their understanding of technology with legal/ethical sagacity, which is laughable.
> When is the onus on the web server owner to configure their security properly? When is a "200 OK" response actually not okay? This is the "mind reader" aspect the article mentions
This is why the laws usually care about the intent. It's a combination of the action and the reason that's important (which is why there's a difference between murder and manslaughter).
There are no hard and fast rules, and there simply cannot be.
Weev clearly knew that AT&T shouldn't be handing over the information. He wasn't there saying "Wait, this isn't a normal service?".
> The librarian is smart enough to not hand out things like access to the staff lounge, a list of employees and their salaries, or even things like an arbitrary library member's borrowing history.
If the librarian didn't know to restrict access to salary information, lets say the managers thought that if you knew the SSN that was enough of an ID to get access, and you repeat the example, it becomes a bit more clear how intent is important.
You: Can I have the salary of IanCal?
Recep: Sure, it's £X
You: Hmm, hey Dave, I think there's a security issue here, mind if I know your salary?
Dave: Sure, it's £Y
You: Can I have the salary of Dave?
Recep: Sure, it's £Y
You: Best go tell the managers.
That would be looked on very differently than: You: Can I have the salary of IanCal?
Recep: Sure, it's £X
You: Hmm, hey Dave, I think there's a security issue here, can you generate SSN numbers?
Dave: Yeah I think so
You: Can I have the salary of SSN#1
Recep: Sure, it's £Y
...
You: Can I have the salary of SSN#147934
Recep: Sure, it's £Y
You: Hahahahaha, let's give all the info to a news site, bet you'd make money shorting the stock!
The core of it is the same, you've requested information for someone else that you shouldn't really have. Even if you remove the consent of Dave in the example, it's still different than the second example. And that was what was important.I've been trying to think of a proper analogy to changing your user agent. Wearing a fake mustache and requesting information from someone publicly giving information to only mustachioed persons?
You: Can I borrow the book identified by ISBN 1234?
Librarian: We restrict access to that book to only people who will read it with our page turning machine.
You: Can I borrow the book identified by ISBN 1234? I am using your page turning machine now.
Librarian: Sure, here you go.I'm deeply suspicious of the "tradition" either way since working at a place where it was actually a policy violation to tell a coworker what your salary was. Because then they would know if they were getting stiffed, and they might ask a raise.
The result of having a wide range of salaries in your social circles is that salary becomes taboo. There is little good to come of talking about it with non-coworker friends, somebody is just going to end up feeling bad, or jealous, or self-conscious, or asked for a personal loan... Even more closely guarded than salary is personal worth, for many of the same reasons, and more.
If this taboo doesn't exist outside the US (and I rather doubt claims that it really doesn't), I would nevertheless refuse to participate in non-anonymized discussions about salary in those settings. What good could come of it?
This taboo carries over to the workplace and into interactions between coworkers who arguably could benefit from discussing salary. If it were born just from employee handbook rules, then nobody would respect it. There are plenty of other rules in those things that nobody reads.
AT&T should be rightly mocked for their poor security, but weev wasn't just stumbling through data, he'd made good attempts to impersonate the setup the server wanted. He'd put a pair of glasses and a funny moustache on and the server was alright with it, which is definitely ridiculous.