--
Ilya Martynov
(http://martynov.org/)
|
|---|
| Replies are listed 'Best First'. | ||
|---|---|---|
|
Re: Hacking CGI - security and exploitation
by cjf (Parson) on Jun 24, 2002 at 20:54 UTC | ||
A couple small problems with the paper: On the plus side, it was fairly in-depth (could have been broken down into separate parts though) and it's always good to see coverage of cross-site scripting and other commonly ignored security issues. Update: In question 12 ("I heard "homemade" CGI scripts are more vulnerable to being hacked than distributed") he could have mentioned NMS scripts as a quality alternative. For bonus points he could start a flamewar and say "but crackers have access to their source code" ;). | [reply] [d/l] | |
|
Re: Hacking CGI - security and exploitation
by crazyinsomniac (Prior) on Jun 24, 2002 at 21:47 UTC | ||
Edited: ~Mon Jun 24 22:21:50 2002 (GMT), | [reply] [d/l] [select] | |
by cjf (Parson) on Jun 25, 2002 at 02:41 UTC | ||
Well, he at least appears to be trying to use imaginary variables. If you change some of them around, you can eventually get a script that works (if you can call it that), you'll also have to run it from the 'accounts' directory, I didn't fix that:
Now I'm still not sure what he's saying about filename/variable limits in Perl and how they could result in a vulnerability. It certainly doesn't sound accurate. Can someone clarify this? | [reply] [d/l] | |
by Anonymous Monk on Jun 25, 2002 at 03:40 UTC | ||
In this case the programmer is using apparently equivalent file names - one for testing existence of a file and one for creating it. They are not equivalent though because the filesystem limit means that one name is invalid and the other is a file that already exists. So the code thought it was creating a new file to represent a new permission - but instead was replacing an existing access file. So yes. The code presented makes the mistake described. But it would be a non-issue without a whole series of supporting mistakes - first and foremost of which is testing a different filename than you are creating! Oh, to answer your other question? The "following line" was there because disagreements between Perl and system calls on the meaning of a null byte can cause all sorts of fun. Also shell scripts being confused by returns can cause other fun and games. Those characters were therefore known to be dangerous, and therefore were eliminated. | [reply] | |
by cjf (Parson) on Jun 25, 2002 at 03:54 UTC | ||
by Anonymous Monk on Jun 25, 2002 at 10:28 UTC | ||
by Anonymous Monk on Jun 25, 2002 at 02:28 UTC | ||
Of course not checking for directory traversal (../../..) is an even worse mistake. But bonus points for three arg open... | [reply] | |
|
Re: Hacking CGI - security and exploitation
by meraxes (Friar) on Jun 24, 2002 at 19:10 UTC | ||
I didn't really see too too much that was new on that article that couldn't have been found here. Many of the vulnerabilities mentioned are things that should set off alarms in a programmers head in the first place. I can't imagine anyone actually providing a direct portal to files via a form. The SSI, VB and Javascript stuff was interesting, but I'd already read about that sort of thing here. There was a tone in the article that implied Perl was not suited for CGI as it was not written with the net in mind, but neither was much else. I felt like b0iler was placing the responsibility on the language as opposed to the programmer. I didn't like that. Every language has its vulnerabilities and good coding practice in any language is important. 'Twas a nifty little article and it had some valid points, but anyone who does anything in CGI should study the topic very closely before they use a script anyway. | [reply] | |
by cjf (Parson) on Jun 24, 2002 at 21:07 UTC | ||
I can't imagine anyone actually providing a direct portal to files via a form. There have been two recent cases on this site where someone has linked to code they've inherited/written that has done this (and more). Luckily, in both cases they were very open to suggestions and took the code down immediately and went off to learn more about security. anyone who does anything in CGI should study the topic very closely before they use a script anyway. Should and do are two very different things. It's no secret that many people first come into contact with Perl by trying to write a script for their website. Saying "well you should have studied security" after the fact is of little use. The more that is written on the subject, and the more commonplace it becomes, the better. | [reply] | |
by meraxes (Friar) on Jun 25, 2002 at 00:27 UTC | ||
Fair enough. I guess it was a bit of a knee jerk reaction. I'm just not fond of those who blame the tool instead of the user (and to me that seemed to be what the author was doing). The presentation seemed a little cavalier to me. I'm mediocre at best (but improving, thanks perl monks) and tend to be very paranoid. However, it still seems horrifically lax not to look up these sorts of things (to me at least). I do mostly data munging so I'm hardly an expert. You are right though. Consider me properly chastised. :) | [reply] | |
by IlyaM (Parson) on Jun 24, 2002 at 19:31 UTC | ||
I agree. There is nothing really new but I've never seen before one paper which summaries several different vulnerabilities like this one. I like this article because it is good introduction for newbie programmers as it covers several topics at same time.
-- | [reply] | |