cinder-api reflects JavaScript input

Bug #1407092 reported by Adam Heczko
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Won't Fix
Undecided
Unassigned
Mirantis OpenStack
Invalid
Low
MOS Cinder
5.0.x
Won't Fix
Low
MOS Cinder
5.1.x
Won't Fix
Low
MOS Cinder
6.0.x
Won't Fix
Low
MOS Cinder
6.1.x
Won't Fix
Low
MOS Cinder
7.0.x
Invalid
Low
Adam Heczko
9.x
Invalid
Low
Adam Heczko
OpenStack Dashboard (Horizon)
Invalid
Undecided
Unassigned
OpenStack Security Advisory
Won't Fix
Undecided
Unassigned

Bug Description

cinder-api reflects JavaScript input which could be used to perform Cross-Site-Scripting attack on a browser which is visiting Horizon interface and working with cinder related gui items

Tags: area-horizon
Revision history for this message
Adam Heczko (aheczko-mirantis) wrote :

Bug tested and exists in vanilla MOS 5.1

Revision history for this message
Dmitry Mescheryakov (dmitrymex) wrote :

Horizon team, please investigate how severe the issue is. Probably it should be reported upstream as a security bug as well.

Changed in mos:
assignee: nobody → MOS Horizon (mos-horizon)
Revision history for this message
Adam Heczko (aheczko-mirantis) wrote :

Hi Dmitry, I believe that this bug is rather Cinder API related than Horizon related. So in my opinion it should be closed by the Cinder team. Maybe upstream.

Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Adam, could you please be more specific? What does 'reflects Javascript input' mean?

Revision history for this message
Adam Heczko (aheczko-mirantis) wrote :

Timur, trying to inject JavaScript into the API I've discovered that API response is too verbose, in fact it responds with the script included in the "original" request, or inother words, reflects original input.
Take a lookat the following request/response pair.
In the response code, everything below the "Connection: close" should be discarded / not printed out.

REQUEST:
<script>cross_site_scripting.nasl</script>

API RESPONSE :

HTTP/1.1 500 Internal Server Error
Content-Type: text/plain
Content-Length: 596
Date: Mon, 29 Dec 2014 09:50:52 GMT
Connection: close

File "/usr/lib/python2.7/dist-packages/paste/urlmap.py", line 119, [...]
"URL fragments must start with / or http:// (you gave %r)" % url)
AssertionError: URL fragments must start with / or http:// (you gave '<s
cript>cross_site_scripting.nasl</script>')

Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Adam, in case the user inputs data via UI provided by Horizon, all data is sanitized thus making XSS impossible. In case you're providing it via Cinder API it's indeed out of scope Horizon team.

Revision history for this message
Dmitry Mescheryakov (dmitrymex) wrote :

Adam, lets reiterate in this bug and another similar one - https://bugs.launchpad.net/mos/+bug/1407093

So, for Cinder and Neutron APIs it is true that if user sends request containing javascript, he will receive response containing the same javascipt. There is no victim in that scenario. So, how that could be exploited?

Revision history for this message
Adam Heczko (aheczko-mirantis) wrote :

Dmitry, please consider that web services needs to ensure that output sent to clients is encoded to be consumed as data and not as scripts. This gets pretty important when web service clients use the output to render HTML pages either directly or indirectly using AJAX/JavaScript objects.
Receiving JavaScript in the browser (Horizon for example) in HTML/Ajax objects where only data is intended could cause damages.
OTOH we are going to implement automatic security scanning to MOS APIs, so besides above concerns, it will raise false-positives into vulnerability testing engines.

Revision history for this message
Dmitry Mescheryakov (dmitrymex) wrote :

Adam, ok, I think I understand your point. It is indeed improper for a service to return non-formatted response. But on the other side, I still fail to see how that can be used as attack. So, overall I think that is not a severe issue.

Revision history for this message
Ivan Kolodyazhny (e0ne) wrote :

Bug was reported to MOS 5.1(Icehouse). Need to test with Juno/Kilo (MOS 6.x/7.x)

Changed in mos:
milestone: 6.1 → 7.0
Igor Shishkin (teran)
Changed in mos:
milestone: 7.0 → 8.0
Changed in mos:
status: Confirmed → Won't Fix
Revision history for this message
Ivan Kolodyazhny (e0ne) wrote :

Can't reproduce with MOS 8:
I've created volume using the following command:
root@node-1:~# cinder create 1 --display-name='<alert>1</alert>dsds'

mysql> select display_name from volumes;
+----------------------+
| display_name |
+----------------------+
| <alert>1</alert>dsds |
| NULL |
+----------------------+
2 rows in set (0.00 sec)

mysql>

Horizon doesn't execute script.

Revision history for this message
Ivan Kolodyazhny (e0ne) wrote :

Oleksiy Butenko can't reproduce this issue with MOS 9 too.

information type: Private Security → Public
information type: Public → Private Security
Revision history for this message
Dina Belova (dbelova) wrote :

More than a month in the incomplete state, moving to Invalid. Please move back to Confirmed if the issue is still reproducible.

tags: added: area-horizon
Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

Since this report concerns a possible security risk, an incomplete security advisory task has been added while the core security reviewers for the affected project or projects confirm the bug and discuss the scope of any vulnerability along with potential solutions.

Does horizon sanitize cinder-api message ?

Changed in ossa:
status: New → Incomplete
Revision history for this message
Lin Hua Cheng (lin-hua-cheng) wrote :

horizon does not directly render the error message from the backend, due to the backend messages are not translatable. So we have low risk this is happening in horizon.

Even if we direct render the backend message, when we render the message on django template, we automatically escape the messages.

For example :

https://github.com/openstack/horizon/blob/master/horizon/templates/horizon/_messages.html#L10

{{ messages }} automatically escape the string rendered, unless the string is explicit set as "safe" which don't normally do.

Marking as invalid for horizon.

Changed in horizon:
status: New → Invalid
Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

Based on the above comment i've closed the OSSA task. I'm not sure about MOS affect, is it safe to also switch this bug report to public ?

Changed in ossa:
status: Incomplete → Won't Fix
Revision history for this message
Jeremy Stanley (fungi) wrote :

On second thought, I've added cinder to this bug and subscribed their core security reviewers just to confirm whether or not they want to limit/filter the inclusion of user input in their API error response messages. Regardless, since there's no known impact this should probably be worked in public from this point.

Changed in ossa:
status: Won't Fix → Incomplete
Revision history for this message
Morgan Fainberg (mdrnstm) wrote :

For what it's worth, Keystone had a similar bug that we simply said "wont fix" as sanitizing the response (don't render JSON as html) is largely the client's responsibility.

I believe this bug should be switched to public at this point.

Revision history for this message
Grant Murphy (gmurphy) wrote :

+1 for moving this to public.

Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

I switch this bug to public based on above comments.

information type: Private Security → Public
Revision history for this message
Tristan Cacqueray (tristan-cacqueray) wrote :

@cinder-coresec, could you check please comment #17 ? If that's ok for you, we'd like to close the OSSA task of this bug.

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote :

I have to agree with Morgan's comment (comment #18). I don't see this as a vulnerability concern from the Cinder perspective.

Changed in cinder:
status: New → Won't Fix
Changed in ossa:
status: Incomplete → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.