-
Notifications
You must be signed in to change notification settings - Fork 176
Fix zip slip vulnerability in unzip utility #10944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Enhanced the unzip method to validate entry paths and prevent zip slip attacks by ensuring extracted files remain within the destination directory. Also improved directory creation and resource management using try-with-resources. references: dylwedma11748/JTegraNX@dd5c2e1 https://cwe.mitre.org/data/definitions/22.html
@th555555 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Summary
Fixed a critical XML External Entity (XXE) vulnerability in the
newDocument
method that could allow attackers to read local files, perform SSRF attacks, or cause denial of service.Vulnerability Details
CVE Impact: High - XML External Entity (XXE) Injection (CWE-611)
CVSS Score: 8.8 (High - Information disclosure and SSRF possible)
Related CVEs: CVE-2021-42550, CVE-2020-25649
Issue Description
The original implementation created a
DocumentBuilderFactory
without security configurations, making it vulnerable to XXE attacks:This allows malicious XML input to:
file://
protocolAttack Example
Malicious XML could exploit this vulnerability:
Security Fix Applied
XXE Prevention Measures:
Key Security Improvements:
Disable External DTD Access:
XMLConstants.ACCESS_EXTERNAL_DTD
set to empty stringDisable External Schema Access:
XMLConstants.ACCESS_EXTERNAL_SCHEMA
set to empty stringAdded Required Imports:
javax.xml.XMLConstants
for security constantsBefore (Vulnerable)
After (Secure)