String "..%c0%af" causes 500 errors in multiple locations
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
Incomplete
|
Undecided
|
Unassigned | ||
Glance |
New
|
Undecided
|
Unassigned | ||
OpenStack Identity (keystone) |
Won't Fix
|
Low
|
Unassigned | ||
OpenStack Security Advisory |
Won't Fix
|
Undecided
|
Unassigned | ||
neutron |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
While doing some testing on Keystone using Syntribos (https:/
Here are some examples:
=========
DELETE /v3/policies/
Host: [REDACTED]:5000
Connection: close
Accept-Encoding: gzip, deflate
Accept: application/json
User-Agent: python-
X-Auth-Token: [REDACTED]
Content-Length: 0
HTTP/1.1 500 Internal Server Error
Date: Tue, 16 Aug 2016 22:04:27 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: X-Auth-Token
X-Distribution: Ubuntu
x-openstack-
Content-Length: 143
Connection: close
Content-Type: application/json
{"error": {"message": "An unexpected error prevented the server from fulfilling your request.", "code": 500, "title": "Internal Server Error"}}
=========
PATCH /v3/policies/
Host: [REDACTED]:5000
Connection: close
Accept-Encoding: gzip, deflate
Accept: application/json
User-Agent: python-
Content-type: application/json
X-Auth-Token: [REDACTED]
Content-Length: 70
{"type": "--serializatio
HTTP/1.1 500 Internal Server Error
Date: Tue, 16 Aug 2016 22:05:36 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: X-Auth-Token
X-Distribution: Ubuntu
x-openstack-
Content-Length: 143
Connection: close
Content-Type: application/json
{"error": {"message": "An unexpected error prevented the server from fulfilling your request.", "code": 500, "title": "Internal Server Error"}}
=========
GET /v3/domains/
Host: [REDACTED]:5000
Connection: close
Accept-Encoding: gzip, deflate
Accept: application/json
User-Agent: python-
X-Auth-Token: [REDACTED]
HTTP/1.1 500 Internal Server Error
Date: Tue, 16 Aug 2016 22:07:09 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: X-Auth-Token
X-Distribution: Ubuntu
x-openstack-
Content-Length: 143
Connection: close
Content-Type: application/json
{"error": {"message": "An unexpected error prevented the server from fulfilling your request.", "code": 500, "title": "Internal Server Error"}}
=========
I've marked this as a security issue as a precaution in case it turns out that there is a more serious vulnerability underlying these errors. We have no reason to suspect that there is a greater vulnerability at this time, but given the many endpoints this seems to affect, I figured caution was worthwhile since this may be a framework-wide issue. Feel free to make this public if it is determined not to be security-impacting.
Here is a (possibly incomplete) list of affected endpoints. Inserting the string "..%c0%af" in any or all of the spots labeled "HERE" should yield a 500 error. As you can see, virtually all v3 endpoints exhibit this behavior.
=========
[GET|PATCH|DELETE] /v3/endpoints/
[GET|PATCH] /v3/domains/[HERE]
GET /v3/domains/
[HEAD|PUT|DELETE] /v3/domains/
GET /v3/domains/
[HEAD|DELETE] /v3/domains/
[GET|PATCH|DELETE] /v3/groups/[HERE]
[HEAD|PUT|DELETE] /v3/groups[
[POST|DELETE] /v3/keys/[HERE]
[GET|PATCH|DELETE] /v3/policies/[HERE]
[GET|PUT|DELETE] /v3/policies/
[GET|HEAD] /v3/policies/
[GET|PUT|DELETE] /v3/policies/
[PUT|DELETE] /v3/policies/
[GET|PUT|DELETE] /v3/policies/
[GET|PATCH|DELETE] /v3/projects/[HERE]
[DELETE|PATCH] /v3/projects/
GET /v3/projects/
GET /v3/projects/
[HEAD|PUT|DELETE] /v3/projects/
[GET|PATCH|DELETE] /v3/regions/[HERE]
[PATCH|DELETE] /v3/roles/[HERE]
[GET|PATCH|DELETE] /v3/services/[HERE]
[GET|PATCH|DELETE] /v3/users/[HERE]
GET /v3/users/
POST /v3/users/
GET /v3/users/
GET /v3/OS-
[GET|PATCH|DELETE] /v3/OS-
[GET|DELETE] /v3/OS-
Changed in keystone: | |
status: | New → Confirmed |
Changed in keystone: | |
importance: | Undecided → Low |
Changed in keystone: | |
status: | Confirmed → Incomplete |
Changed in keystone: | |
status: | Incomplete → Won't Fix |
Changed in neutron: | |
status: | Incomplete → Won't Fix |
This happens because webob tries to decode the path as UTF-8, but that is actually malformed UTF-8. This is probably something that should be caught in keystone. common. wsgi and returned as a 400, but I don't think these is any security issues. Is it possible to use this to exploit keystone is some way.
Log from a bad request:
2016-08-16 23:45:25.192 14345 ERROR keystone. common. wsgi [req-dd271afd- aa0c-4fd2- 90f2-6366327e9b ba - - - - -] 'utf8' codec can't decode byte 0xc0 in position 12: invalid start byte common. wsgi Traceback (most recent call last): common. wsgi File "/opt/stack/ keystone/ keystone/ common/ wsgi.py" , line 372, in _inner common. wsgi return method(self, request) common. wsgi File "/opt/stack/ keystone/ keystone/ common/ wsgi.py" , line 432, in __call__ common. wsgi response = request. get_response( self.applicatio n) common. wsgi File "/usr/local/ lib/python2. 7/dist- packages/ webob/request. py", line 1299, in send common. wsgi application, catch_exc_ info=False) common. wsgi File "/usr/local/ lib/python2. 7/dist- packages/ webob/request. py", line 1263, in call_application common. wsgi app_iter = application( self.environ, start_response) common. wsgi File "/usr/local/ lib/python2. 7/dist- packages/ webob/dec. py", line 130, in __call__ common. wsgi resp = self.call_func(req, *args, **self.kwargs) common. wsgi File "/usr/local/ lib/python2. 7/dist- packages/ webob/dec. py", line 195, in call_func common. wsgi return self.func(req, *args, **kwargs) common. wsgi File "/opt/stack/ keystone/ keystone/ common/ wsgi.py" , line 687, in __call__ common. wsgi if request.path_info != '/': common. wsgi File "/usr/local/ lib/python2. 7/dist- packages/ webob/descripto rs.py", line 68, in fget common. wsgi return req.encget(key, encattr=encattr) common. wsgi File "/usr/local/ lib/python2. 7/dist- packages/ webob/request. py", line 177, in encget common. wsgi return val.decode( encoding) common. wsgi File "/usr/lib/ python2. 7/encodings/ utf_8.py" , line 16, in decode common. wsgi return codecs. utf_8_decode( input, errors, True) common. wsgi UnicodeDecodeError: 'utf8' codec can't decode byte 0xc0 in position 12: invalid start byte
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.
2016-08-16 23:45:25.192 14345 TRACE keystone.common....