CVE-2011-1364
CSRF in Google App Engine Python SDK < 1.5.4 enables remote code execution via admin authentication hijack
- CVSS 6.8
- CWE-352 Cross-Site Request Forgery (CSRF)
- Configuration Issues
- Remote
Cross-site request forgery (CSRF) vulnerability in _ah/admin/interactive/execute (aka the Interactive Console) in the SDK Console (aka Admin Console) in the Google App Engine Python SDK before 1.5.4 allows remote attackers to hijack the authentication of administrators for requests that execute arbitrary Python code via the code parameter.
- CVSS base score
- 6.8
- Published
- 2011-10-30
- OWASP
- A07 Identification and Authentication Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Configuration Issues
- Subcategory
- Cross-Site Request Forgery (CSRF)
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Google App Engine Python SDK
- Fixed by upgrading
- Yes
Solution
Update Google App Engine Python SDK to version 1.5.4 or higher.
Vulnerable code sample
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
class InteractiveConsoleHandler(webapp.RequestHandler):
def post(self):
code = self.request.get('code')
# Execute the code without any CSRF protection
exec(code)
app = webapp.WSGIApplication([
('/_ah/admin/interactive/execute', InteractiveConsoleHandler),
], debug=True)
def main():
util.run_wsgi_app(app)
if __name__ == '__main__':
main()Patched code sample
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
import webapp2
class InteractiveConsoleHandler(webapp2.RequestHandler):
def post(self):
# Check for CSRF token
csrf_token = self.request.get('csrf_token')
if not self.is_valid_csrf_token(csrf_token):
self.abort(403) # Forbidden if CSRF token is invalid
code = self.request.get('code')
# Execute the code securely
# ...
def is_valid_csrf_token(self, token):
# Implement CSRF token validation logic here
return token == self.get_expected_csrf_token()
def get_expected_csrf_token(self):
# Logic to retrieve the expected CSRF token for the session
return 'expected_csrf_token'
app = webapp2.WSGIApplication([
('/_ah/admin/interactive/execute', InteractiveConsoleHandler),
], debug=True)
def main():
util.run_wsgi_app(app)
if __name__ == '__main__':
main()Cite this entry
@misc{vaitp:cve20111364,
title = {{CSRF in Google App Engine Python SDK < 1.5.4 enables remote code execution via admin authentication hijack}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2011},
note = {VAITP Python Vulnerability Dataset, entry CVE-2011-1364},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2011-1364/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
