This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2008年03月07日 19:59 by m.sucajtys, last changed 2022年04月11日 14:56 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| CGIHTTPServer_is_cgi_fix2.diff | gpolo, 2008年03月07日 21:10 | |||
| CGIHTTPServer_is_cgi_doc_fix.diff | gpolo, 2008年03月07日 21:38 | is_cgi docstring correction | ||
| Messages (7) | |||
|---|---|---|---|
| msg63361 - (view) | Author: sumar (m.sucajtys) | Date: 2008年03月07日 19:59 | |
================================================================================ Summary: ================================================================================ An information disclosure flaw exists in standard python CGIHTTPServer module. Bug is confirmed in python 2.5 @ fedora 7 (python-2.5-15.fc7). ================================================================================ Description: ================================================================================ Requesting cgi script (in example test.py) without / in the beginnig of URL cause return script content/code instead of script execution. It could lead to disclose some secret information eg. password. ================================================================================ Exploit code: ================================================================================ Connected to localhost. Escape character is '^]'. GET cgi-bin/test.py HTTP/1.0 HTTP/1.0 200 OK Server: SimpleHTTP/0.6 Python/2.5 Date: 2008年3月07日 14:55:30 GMT Content-type: text/plain Content-Length: 150 Last-Modified: 2008年3月07日 14:55:04 GMT #!/usr/bin/env python print 'Content-Type: text/html' print 'Cache-Control: no-cache' print print 'Hello' passwd='secret' path=/opt/myapp/secretpath Connection closed by foreign host. ================================================================================ correct request: ================================================================================ Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET /cgi-bin/test.py HTTP/1.0 HTTP/1.0 200 Script output follows Server: SimpleHTTP/0.6 Python/2.5 Date: 2008年3月07日 15:01:03 GMT Content-Type: text/html Cache-Control: no-cache Hello Connection closed by foreign host. ================================================================================ |
|||
| msg63364 - (view) | Author: Guilherme Polo (gpolo) * (Python committer) | Date: 2008年03月07日 21:06 | |
I'm attaching a patch that fixes this, it was done for rev 61179 (trunk). Note that is_cgi method is incorrectly documented, even more now. Only the first line in its docstring is correct now, before this patch, last paragraph was correct too. |
|||
| msg63365 - (view) | Author: Guilherme Polo (gpolo) * (Python committer) | Date: 2008年03月07日 21:10 | |
oops, I was doing some tests in the last patch and left a bug in it. I'm attaching a new one. |
|||
| msg63368 - (view) | Author: Guilherme Polo (gpolo) * (Python committer) | Date: 2008年03月07日 21:38 | |
This corrects is_cgi docstring (maybe this should be done in a new issue?). It also removes a part of it that I believe to not be necessary, someone correct me if I'm wrong. |
|||
| msg67335 - (view) | Author: Gregory P. Smith (gregory.p.smith) * (Python committer) | Date: 2008年05月25日 09:23 | |
Could you please create a test case for this as a patch to Lib/test/test_httpservers.py? thanks! |
|||
| msg85596 - (view) | Author: Gregory P. Smith (gregory.p.smith) * (Python committer) | Date: 2009年04月06日 00:23 | |
fyi - Your patch does not work on windows as it uses os.path for uri manipulation. that means it behaves differently with regards to / and \ based on platform. I'm making a new one. I've written a unittest. should be fixed soon. |
|||
| msg85614 - (view) | Author: Gregory P. Smith (gregory.p.smith) * (Python committer) | Date: 2009年04月06日 06:39 | |
Fixed in trunk r71303. This potentially changes the behavior of CGIHTTPServer (for the better) so this is probably not appropriate to backport to a release branch unless someone really considers the security of this to be severe. If backported, the new module function should be expanded inline to avoid adding a new (though undocumented) API. Closing. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:56:31 | admin | set | github: 46507 |
| 2009年04月06日 06:39:35 | gregory.p.smith | set | status: open -> closed resolution: fixed messages: + msg85614 versions: + Python 2.6, Python 3.0 |
| 2009年04月06日 06:24:35 | gregory.p.smith | set | files: - CGIHTTPServer_is_cgi_fix.diff |
| 2009年04月06日 00:23:31 | gregory.p.smith | set | messages: + msg85596 |
| 2008年05月25日 09:23:25 | gregory.p.smith | set | priority: normal assignee: gregory.p.smith messages: + msg67335 nosy: + gregory.p.smith |
| 2008年03月07日 21:38:38 | gpolo | set | files:
+ CGIHTTPServer_is_cgi_doc_fix.diff messages: + msg63368 |
| 2008年03月07日 21:10:19 | gpolo | set | files:
+ CGIHTTPServer_is_cgi_fix2.diff messages: + msg63365 |
| 2008年03月07日 21:06:02 | gpolo | set | files:
+ CGIHTTPServer_is_cgi_fix.diff keywords: + patch messages: + msg63364 nosy: + gpolo |
| 2008年03月07日 19:59:44 | m.sucajtys | create | |