project_id could be overwritten to any value by URI value
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
High
|
Thierry Carrez | ||
Diablo |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
project_id could be overwritten to any value by URI value.
User can create server on any project (even if it is not exist)
Quota function will not be working because of this bug. (So This bug is a security vulnerability)
--Test condition
user : demo (not admin)
project_id: 2
-- Requeest
stack@freecloud
-- Response
{"server": {"status": "BUILD", "updated": "2011-12-
-- DB result
instance with project_id "tushar2" is created
mysql> select id,project_id from instances;
+----+------------+
| id | project_id |
+----+------------+
| 1 | demo5 |
| 2 | demo5 |
| 3 | tushar |
| 4 | tushar1 |
| 5 | tushar2 |
| 6 | tushar2 |
| 7 | tushar2 |
+----+------------+
7 rows in set (0.00 sec)
--Cause of this bug
This code set project_id to request object from uri
https:/
Then this code set the project_id to context object
https:/
visibility: | private → public |
Changed in nova: | |
milestone: | none → essex-3 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | essex-3 → 2012.1 |
fix is pretty easy, but fixing the tests afterwards is really annoying.
diff --git a/nova/ api/openstack/ wsgi.py b/nova/ api/openstack/ wsgi.py api/openstack/ wsgi.py api/openstack/ wsgi.py wsgi.Applicatio n): exc.HTTPBadRequ est(explanation =msg))
index 1ffca9e..5760f88 100644
--- a/nova/
+++ b/nova/
@@ -560,8 +560,10 @@ class Resource(
return Fault(webob.
project_id = args.pop( "project_ id", None) environ[ 'nova.context' ].project_ id = project_id environ[ 'nova.context' ].project_ id): exc.HTTPBadRequ est(explanation =msg))
- if 'nova.context' in request.environ and project_id:
- request.
+ if ('nova.context' in request.environ and project_id
+ and project_id != request.
+ msg = _("Malformed request url")
+ return Fault(webob.
try:
action_ result = self.dispatch( request, action, args)