PT0-003 practice question 7 of 30
[Attacks and Exploits] A penetration tester finds that an application responds with the contents of the /etc/passwd file when the following payload…
Full set: 351 questions[Attacks and Exploits] A penetration tester finds that an application responds with the contents of the /etc/passwd file when the following payload is sent:
xml Copy code ]> &foo;
Which of the following should the tester recommend in the report to best prevent this type of vulnerability?
The provided payload is a classic example of an XML External Entity (XXE) injection attack. The vulnerability exists because the application's XML parser is configured to process external entities defined within a Document Type Definition (DTD). The payload defines an entity &foo; that points to a local system file (/etc/passwd). When the parser resolves this entity, it includes the file's contents in the response. The most direct and effective method to prevent this vulnerability is to disable the processing of external entities and DTDs within the XML parser configuration. This remediation addresses the root cause at the application level, rendering it immune to this attack vector.
A. Drop all excessive file permissions with chmod o-rwx: This is a general hardening measure but does not fix the root cause, as the application's user context may still have legitimate read access to the file.
B. Ensure the requests application access logs are reviewed frequently: This is a detective control used to identify an attack after it has occurred, not a preventive measure to stop the vulnerability from being exploited.
D. Implement a WAF to filter all incoming requests: While a WAF can block known XXE patterns, it is a compensating control that can potentially be bypassed. The most secure solution is to fix the underlying vulnerability in the application code.
1. MIT OpenCourseWare (OCW)
6.858 Computer Systems Security
Fall 2014. Lecture 11: Web Security
Slide 32
"XML external entity (XXE) attacks
" lists "Disable DTDs
external entities" as the primary defense mechanism. This directly supports disabling the feature as the correct prevention strategy.
2. National Institute of Standards and Technology (NIST)
Special Publication 800-95
Guide to Secure Web Services. Section 4.3.3
"Entity Expansion
" discusses the risks of entity processing. It recommends that "XML parsers should be configured to limit the number of entity expansions... It may also be possible to disable entity expansion entirely." This highlights disabling the feature as a valid and recommended security control.
3. OWASP Foundation
XML External Entity (XXE) Prevention Cheat Sheet. While OWASP is a non-profit foundation
its publications are widely recognized as authoritative in the field of web application security and are frequently referenced in academic and professional contexts. The cheat sheet explicitly states
"The safest way to prevent XXE is to always disable DTDs (External Entities) completely." It provides code-level examples for various programming languages on how to disable DTD and external entity processing in XML parsers.
Keep practicing
Take the free PT0-003 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PT0-003 practice questions
- Question 1[Attacks and Exploits] A penetration tester is trying to get unauthorized access to a web…
- Question 2[Attacks and Exploits] During an internal penetration test, a tester compromises a Window…
- Question 3[Attacks and Exploits] During an assessment, a penetration tester gains a low-privilege s…
- Question 4A penetration tester cannot complete a full vulnerability scan because the client's WAF i…
- Question 5[Tools and Code Analysis] Which of the following techniques is the best way to avoid dete…
- Question 6[Attacks and Exploits] A penetration tester finishes a security scan and uncovers numerou…
