PDA

Bekijk Volledige Versie : RE: redirection vuln crawlers breed & security through obscurity



Evans, Arian
20/04/06, 01:20
1. This is definitely a pretty common, if not well-known
problem, being "broken access control" that relies on
obscurity or something weak/trivial to forge (like an
HTTP refer field path) to control access to an entry
point in a webapp. Sometimes, no further authorization
checks are made (on pages/functions behind the entrypoint).

2. Tools already exist that allow you to manually ignore
redirects per your question blow, and some do this automatically.
www.owasp.org and www.webappsec.org are good places to start.

3. This said, "how secure?" in this case is a math problem.
Given you know the directory structure, if all you are doing
is trying to brute-force enumerate the file name, then all
you have is a fuzzing problem plus HTTP requests/sec rate
(that is realistic to achieve).

If your admin default page is "supersexysecretsignon.php"
I can turn a fuzzer lose on this until I get an HTTP 200 OK,
or a change in body content, and automatically flag the page.

In the case above, I have 21 characters to fuzz plus an
page extension, so (21^27 * [$.extensions]) to work through.

I could fuzz *everything* or be lazy and fuzz a variable
and tack on a list of say 10 well-known extensions to each
iteration of the variable.

Assuming I do not know the page name, let's take 50 chars
ASCII/numeric, assume it is case-sensitive on *nix, so you
would have 50^64 possible combinations starting at "a".
Then multiply that times the number of extensions you want
to try, unless you want to fuzz those characters too.

How fast you could work through that keyspace is a good
question. I recommend you Google for Mike Shema's work
on session token entropy from RSA '05 and later, and
he has excellent tables on 'n' HTTP/req/sec =3D $work_time
to exhaust a given keyspace, which is exactly what you
are essentially asking here I believe.

Excellent questions, again. Two good mailing lists to ask
these sorts of questions on are:

webappsec@securityfocus.com
websecurity@webappsec.org

Double-check my math. I haven't my coffee today, adding
to my native processor's already unfortunate tendency to
introduce random floating-point error into my ad-hoc calculations,

Arian J. Evans
FishNet Security

Note: Microsoft Office breaks text-based emails by default.
To see text messages properly formatted, turn off:
Tools>Options>|Email Options|+Remove Extra Line Breaks

816.421.6611 [fns office]
816.701.2045 [direct]
888.732.9406 [fns toll-free]
816.421.6677 [fns general fax]
913.710.7085 [mobile] <--best bet
aevans@fishnetsecurity.com [email]

http://www.fishnetsecurity.com



> -----Original Message-----
> From: Ivan Sergio Borgonovo [mailto:mail@webthatworks.it]=20
> Sent: Saturday, April 15, 2006 7:47 AM
> To: bugtraq@securityfocus.com
> Subject: redirection vuln crawlers breed & security through obscurity
>=20
>=20
> I just came across such kind of code (php) written by a colegue:
>=20
> //header.inc
> if($_SESSION['UN']!=3D'hardcoded_UN' or =
$_SESSION['UN']!=3D'hardcoded_PW')
> header("Location: ./login.html");
> //missing else to mitigate the problem!!
> //HTML stuff here...
>=20
> code structure of all the other "supposed to be" private pages is:
>=20
> //wannabeprotected.php
> include_once("include/header.inc")
> //wannabe protected code
>=20
> Everything resides at something like:
> http://site/admin/
>=20
> of course the ONLY thing you've to do to break into the admin=20
> interface is:
> - disable redirection in your preferred browser (w3m)
> - guess the right address and
> - point exactly to it: http://site/admin/index.php or any=20
> existing page[1] eg. http://site/admin/killingmesoftly.php
>=20
> http://site/admin/ won't work. I did some research to see if=20
> you could find a way to make "educated guess" by examining=20
> the flow of HTTP responses, but I didn't came out with any=20
> good idea. Nevertheless index.php doesn't seem to be a bad=20
> educated guess (as Default.asp, index.asp, index.pl, login.asp...).
>=20
> Now some questions and a proposal:
> - how safe is to rely on secrecy of the URL? I'm looking for=20
> a quantification of the risk, not a "it is a bad idea" ;)
> of course http://site/`pwgen -N1 30`/`pwgen -N1 30`.php is=20
> safer than http://site/admin/index.php. Any already made=20
> study? numbers?
> - are SE like google going to index such kind of pages if=20
> there is no "external" link ?
> - are there already many specialized vuln crawlers looking=20
> for such kind of URLs?
>=20
> What about building crawlers that ignore redirection to scan=20
> for such kind of vulns?
> I think that kind of mistake should be pretty popular.
>=20
> Did I reinvent the wheel?
>=20
> [1] this makes educated guessing easier increasing the number=20
> of potential targets: manager.php, insert.php, delete.php and=20
> it makes this [in]security model rely just on the dir path...=20
> unless the programmer is so crazy to call all his files with=20
> random names. But coding the access credential in a path=20
> makes the code not that relocable... etc... etc..
>=20
> What I mean: it exists a chain of links that connect that=20
> page with a link on a homepage or an already indexed page.
>=20
> BTW the colegue didn't set any association between .inc and=20
> the php interpreter. So you can even get the header.inc=20
> source with another maybe harder educated guess.
>=20
> ... and happy Easter holidays.
>=20
> --=20
> Ivan Sergio Borgonovo
> http://www.webthatworks.it
>=20