{"id":1002,"cve":"CVE-2023-52288","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2023-52288","cwe":"CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')","cwe_number":22,"cwe_url":"https:\/\/cwe.mitre.org\/data\/definitions\/22","cvss_score":7.5,"published":"2024-01-13","owasp":"A01 Broken Access Control","odc":"Checking","cdc":"Incorrect Check","category":"Input Validation and Sanitization","subcategory":"Path Traversal","scope":"Remote","impact":"Information Disclosure","summary":"Unauthenticated directory traversal in flaskcode (through 0.0.8) allows reading arbitrary files via a GET request to a \/resource-data\/.txt URI","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2023-52288\/","description":"An issue was discovered in the flaskcode package through 0.0.8 for Python. An unauthenticated directory traversal, exploitable with a GET request to a \/resource-data\/.txt URI (from views.py), allows attackers to read arbitrary files.","solution":"Update to flaskcode version 0.0.9 or higher","affected_component":"Python","fixed_by_upgrading":true,"vulnerable_code":"from flask import Flask, send_file\n\napp = Flask(__name__)\n\n@app.route('\/resource-data\/<path:filename>.txt', methods=['GET'])\ndef get_resource_data(filename):\n    file_path = f'.\/{filename}.txt'\n    return send_file(file_path)\n\nif __name__ == '__main__':\n    app.run()","patched_code":"from flask import Flask, send_file, abort\nimport os\n\napp = Flask(__name__)\n\nBASE_DIR = '\/base\/directory'\n\n@app.route('\/resource-data\/<path:filename>.txt', methods=['GET'])\ndef get_resource_data(filename):\n    base_filename = os.path.basename(filename)\n    file_path = os.path.join(BASE_DIR, base_filename + '.txt')\n\n    if os.path.isfile(file_path):\n        return send_file(file_path)\n    else:\n        abort(404)\n\nif __name__ == '__main__':\n    app.run()","payload_needed":false,"payload":null,"payload_status":"none","published_fix":[],"references":null}