Improper Restriction of XML External Entity Reference ('XXE')
ID |
scala.xxe.scala_xxe_rule_trans |
Severity |
high |
Resource |
Xxe |
Language |
Scala |
Description
XML External Entity (XXE) attacks can occur when an XML parser supports XML entities while processing XML received from an untrusted source.
Rationale
XML External Entity (XXE) attacks can occur when an XML parser supports XML entities while processing XML received from an untrusted source.
The following code illustrates a vulnerable pattern detected by this rule:
def parseXMLdefaultValue(input: Source): Unit = {
val factory = TransformerFactory.newInstance
val transformer = factory.newTransformer
val outWriter = new StringWriter
val result = new StreamResult(outWriter)
// VULNERABLE: Improper Restriction of XML External Entity Reference ('XXE')
transformer.transform(input, result)
outWriter.toString
}
Remediation
Follow secure coding practices and review the references below for detailed remediation guidance.
References
-
OWASP Top 10 2021 - A05 : Security Misconfiguration.