So what cookies does this demo steal?
All your planscalendar.com cookies. That's PROBABLY just your
preferences for
the demo,
the
wiki, and the session ID for
the forums,
assuming you've used any of them. If you're a forum admin, I
might be able to pinch your admin rights. If you've never used the
demo, the wiki, or the forum, it might not get any cookies at all.
As far as I know, planscalendar.com doesn't have an online store or
webmail or anything outrageously secure on it.
Will you show me what you steal?
Yup. If I was a really nasty guy, I wouldn't, I'd just send you to a
fake error page or something after I'd copied everything I
wanted.
So what COULD you steal?
Google
tells me there are "about 2,130" instances of Plans out
there. I could steal all your cookies from any of those sites. That
MIGHT include webmail accounts, shopping carts, etc etc. If your ISP
has plans.cgi on the same domain as your webmail / control panel /
shop, you should probably ask them to move it to a different domain.
What can you NOT do?
I'm not gaining access to your machine, I'm not gaining access to
files on planscalendar.com or making the server run my code, I'm
getting access to whatever YOU have access to on planscalendar.com,
which (for the purposes of this proof-of-concept) probably just
means I can pretend to be you on the forum. If you're a forum admin,
I might be able to pinch your rights.
I can't steal cookies from other domains, only domains that
have plans.cgi on (well, unless I find one of the multitude of other
vulnerable web apps)
So are you keeping a copy of my cookies?
Not deliberately, but they almost certainly appear in my web logs,
and if I wanted to extract them, I could.
Are you a Nasty Hacker?
No
Are you going to hijack my sessions?
No
Are you going to borrow my forum login?
No
Are you going to borrow my shopping cart?
No. Does planscalendar.com even have an online store?
But I have to take your word for it?
Unfortunately, Yes
How can I trust you?
I could give you my
word as a Spaniard
No good. I've known too many Spaniards.
But seriously?
I could give you my word as an Englishman, which isn't much better,
but no, seriously, how can you trust me? If I'd REALLY wanted
to steal your cookies, I could have done so in a far more sneaky
way, probably without you even knowing, and I hope the description
above makes that clear. I've been up-front, I've warned you about
the risks. If you still choose to give me a copy of your
planscalendar.com cookies, I COULD abuse them, but honestly, I've got
better things to do.
So should I avoid installing Plans?
No, it's a very fine app. Unfortunately it allows Nasty Hackers to
borrow cookies from any site where Plans is installed. I'd therefore
have to recommend you don't install Plans on any site which relies
on the security of any other part of the site, so don't share a site
with webmail, shopping carts, secure logins, online banking, etc.
Put plans on a different domain. You should also definitely avoid
the "choose_themes" option. It's definitely not the only XSS attack
on plans.cgi, but it's the most trivial to abuse
You hate Plans, don't you?
No, I think it's a marvellous little web app, top notch usability,
easy install, easy configurability, looks great, works great,
splendid features. I use it myself, I just hide it behind a bit more
security for the moment. If I hated it, I'd be running a different
web calendar, and probably be putting more effort into securing
that one instead.
So if you're so clever, why don't you fix it
instead of proving you can break it?
I'll probably do both, but if I just fixed it, most people wouldn't
realise the importance of updating it.
So how do I fix it?
There needs to be a fair bit more argument checking in plans.cgi.
theme_url is definitely not the only argument that needs checking.
Using perl's "taint mode" might help, but the program will probably
be completely unusable until every little detail is fixed. Oh, and
"perl -w" and "use strict" are usually well worth the pain too, but
that's a different issue.
Does the author know you're doing this?
I dropped Lloyd an email describing my concerns, and he said:
Nick,
You're correct. The $theme_url parameter dates back to before it
was possible to set each calendar's theme (and before I understood
cross-site scripting attacks).
It needs to be either removed or heavily validated. I'm not sure if
validation is possible, since even checking for the same domain as the
calendar might not always work. I will probably remove it completely.
Thanks for the note. You should definitely post it to the forum.
Hopefully it will get more folks thinking about security concerns.
- Lloyd
I told him I'd do so after I'd put together a proof-of-concept. I
hope he doesn't mind how I've done the proof-of-concept. If he asks
me to remove it, I'll gladly do so. In the meantime I am posting to
the forums
to get you folks thinking about security concerns :-)
So how is plans vulnerable?
At first, and when I wrote to Lloyd, I thought that
?theme_url=http://hacker_domain/bad_theme/ was a gaping hole. It
allows you to load themes from other sites. Turns out it's not
enabled in the default config though, so probably very few of those
"about 2,130" installations use it. Those that do though, go
straight to http://hacker_domain/bad_theme/plans.css and can be
easily made to go straight to color_select.js too - bonus! Easy
place to put my dodgy JavaScript :-)
This is the method I've used for the proof of concept. This method
will NOT exploit (m)any other plans.cgi installations because
"choose_themes" isn't USUALLY enabled. There are other parameters
that can be abused though, probably
on every single one of those "about 2,130", and yes, I've proved
that some other args can be abused, this is no idle threat.
I chose the theme_url method because it's easiest to demonstrate
against the main site without giving away a complete cookbook to
break into every other plans.cgi on the net - "only" ones that have
choose_themes enabled, which I hope is very few. Google says "about
34" and most of those seem to be misleading.
Have you really posted it to the forum? I can't
find it!
Yup,
here.