A critical path traversal vulnerability (CWE-22) has been identified in the review_paper function in backend/app.py. The vulnerability allows malicious users to access arbitrary PDF files on the server by providing crafted file paths that bypass the intended security restrictions.
This vulnerability allows attackers to:
The issue occurs in the review_paper function around line 744:
if pdf_path.startswith("/api/files/"):
# Safe path handling for API routes
relative_path = pdf_path[len("/api/files/"):]
generated_base = os.path.join(project_root, "generated")
absolute_pdf_path = os.path.join(generated_base, relative_path)
else:
absolute_pdf_path = pdf_path # VULNERABLE: Direct use of user input
curl -X POST http://localhost:5000/api/review \
-H "Content-Type: application/json" \
-d '{"pdf_path": "/etc/passwd"}'
This vulnerability was discovered and reported by Ruizhe.
Exploitability
AV:NAC:LAT:NPR:NUI:NVulnerable System
VC:LVI:HVA:NSubsequent System
SC:NSI:NSA:N6.7/CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N/E:UInput Validation