Bugzilla – Bug 947736
VUL-0: CVE-2015-5966: obs: webui: XSS in comments
Last modified: 2017-03-22 16:10:24 UTC
From: Fabian <fvogt@suse.com> To: Adrian =?ISO-8859-1?Q?Schr=F6ter?= <adrian@suse.de> Date: Mon, 28 Sep 2015 10:14:29 +0200 Subject: [security@suse.de] XSS in the OBS Web UI Hi, it is possible to enter unsanitized HTML as comments in the Web-UI, as an example you can visit https://build.suse.de/project/show/home:favogt:XSS-test The comment is fairly trivial: <script>alert("Hi")</script> <iframe src="https://en.opensuse.org"></iframe> This is IMO highly critical, as it is possible to take full control of a logged-in user and even steal passwords if the browser stored them. As any user with an account can comment on everything, including foreign home projects, exploiting this vulnerability would yield a high success rate. By adding a comment on "https://build.opensuse.org/project/show/openSUSE:Factory" I could get maintainer of openSUSE:Factory should one of the maintainers visit the page. By adding a comment on my submit requests, they would get accepted automatically... If done correctly, something like this is very hard to notice, if at all. I wonder why this hasn't been found before (or was it? Hopefully not). Thanks, Fabian
The problem is here https://github.com/openSUSE/open-build-service/blame/master/src/api/app/helpers/comment_helper.rb#L4 we are marking the string as safe.. however it isn't..
bugbot adjusting priority
you should check all "html_safe" calls.. Looks like somebody got it wrong back in the days.. it actually doesn't make the html safe, in the opposite. It marks the html code as "safe" and therefore won't be escaped.. A quick search shows that its quite often used...
Disabled in production
Created attachment 649658 [details] Proposed patch Proposed patch. We think (2 team member independently) the other occurrences of html_safe are fine.
I'm currently working out how we are making releases as Adrian is on vacation until Monday. The patch is already deployed on both instances we control (OBS/IBS).
Looks good to me, but I found out that it is not escaped in the "New comment in project" mail. That's not a big (security) issue though, just a minor inconsistency AFAICS.
It's a nice way to see that someone tried something :-)
I also don't find any comments in the DB anymore which of course doesn't mean that they where never in there. I'm going through the backups that we have now...
Use CVE-2015-5966.
Commits are pushed, release build is running. Making public.
Affected: 2.6.x <= 2.6.4, fixed in 2.6.5. Affected: 2.5.x <= 2.5.7 Not affected: 2.4.x and earlier as they lack this comment function
https://github.com/openSUSE/open-build-service/commit/f0db5a266fec68efa2575b2abbfb0e024e997e62