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 2012年04月12日 19:01 by v+python, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg158162 - (view) | Author: Glenn Linderman (v+python) * | Date: 2012年04月12日 19:01 | |
While is_cgi carefully normalizes the path using _url_collapse_path, if it returns True, then run_cgi is called... which sort of starts out using the cgi_info created by is_cgi, but then compares and searches using the original self.path value instead. This effectively bypasses both the normalization done by _url_collapse_path and the bugs and potential security problems that the normalization was intended to fix! A simple cure is to replace the first two lines of run_cgi: path = self.path dir, rest = self.cgi_info with: dir, rest = self.cgi_info path = '/'.join([ dir, rest ]) While this works, one might wonder why is_cgi splits the normalized path into two pieces to start with, if it gets recombined, and generally, dir and rest, although initialized from cgi_info, often get recalculated in the loop which immediately follows in run_cgi... more often than you might expect, if an unnormalized path is in the original request, but if the path comes in normalized (or the above fix is applied), and the CGI program actually resides directly in one of the cgi_directories directories (rather than below it), then the dir and rest calculated by is_cgi are actually used, and the loop performs only one half iteration. |
|||
| msg222249 - (view) | Author: Mark Lawrence (BreamoreBoy) * | Date: 2014年07月04日 00:39 | |
Can we have a response to this security issue please. |
|||
| msg252075 - (view) | Author: Martin Panter (martin.panter) * (Python committer) | Date: 2015年10月02日 00:47 | |
This was also reported in Issue 19435. The combination changes for Issue 19435 + Issue 21323 looks essentially like the proposed change here. Issue 14567 remains about the double processing of paths. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:29 | admin | set | github: 58771 |
| 2015年10月02日 00:47:18 | martin.panter | set | status: open -> closed superseder: Directory traversal attack for CGIHTTPRequestHandler nosy: + martin.panter messages: + msg252075 resolution: duplicate stage: resolved |
| 2014年08月30日 04:18:32 | terry.reedy | set | versions: - Python 2.6, Python 3.1 |
| 2014年07月04日 00:39:46 | BreamoreBoy | set | nosy:
+ BreamoreBoy messages: + msg222249 versions: + Python 3.4, Python 3.5 |
| 2012年04月12日 19:01:10 | v+python | create | |