This commit is contained in:
Esben Sparre Andreasen 2019-07-04 13:35:00 +02:00
Родитель 5163ccfd39
Коммит 6d5b84fa88
2 изменённых файлов: 56 добавлений и 41 удалений

Просмотреть файл

@ -1,26 +1,16 @@
/**
* Provides a taint tracking configuration for reasoning about XML-bomb
* vulnerabilities.
* Provides a taint tracking configuration for reasoning about
* XML-bomb vulnerabilities.
*
* Note, for performance reasons: only import this file if
* `XmlBomb::Configuration` is needed, otherwise
* `XmlBombCustomizations` should be imported instead.
*/
import javascript
import semmle.javascript.security.dataflow.DOM
module XmlBomb {
/**
* A data flow source for XML-bomb vulnerabilities.
*/
abstract class Source extends DataFlow::Node { }
/**
* A data flow sink for XML-bomb vulnerabilities.
*/
abstract class Sink extends DataFlow::Node { }
/**
* A sanitizer for XML-bomb vulnerabilities.
*/
abstract class Sanitizer extends DataFlow::Node { }
import XmlBombCustomizations::XmlBomb
/**
* A taint-tracking configuration for reasoning about XML-bomb vulnerabilities.
@ -37,28 +27,4 @@ module XmlBomb {
node instanceof Sanitizer
}
}
/** A source of remote user input, considered as a flow source for XML bomb vulnerabilities. */
class RemoteFlowSourceAsSource extends Source {
RemoteFlowSourceAsSource() { this instanceof RemoteFlowSource }
}
/**
* An access to `document.location`, considered as a flow source for XML bomb vulnerabilities.
*/
class LocationAsSource extends Source, DataFlow::ValueNode {
LocationAsSource() { isLocation(astNode) }
}
/**
* A call to an XML parser that performs internal entity expansion, viewed
* as a data flow sink for XML-bomb vulnerabilities.
*/
class XmlParsingWithEntityResolution extends Sink, DataFlow::ValueNode {
XmlParsingWithEntityResolution() {
exists(XML::ParserInvocation parse | astNode = parse.getSourceArgument() |
parse.resolvesEntities(XML::InternalEntity())
)
}
}
}

Просмотреть файл

@ -0,0 +1,49 @@
/**
* Provides default sources, sinks and sanitisers for reasoning about
* XML-bomb vulnerabilities, as well as extension points for adding
* your own.
*/
import javascript
import semmle.javascript.security.dataflow.DOM
module XmlBomb {
/**
* A data flow source for XML-bomb vulnerabilities.
*/
abstract class Source extends DataFlow::Node { }
/**
* A data flow sink for XML-bomb vulnerabilities.
*/
abstract class Sink extends DataFlow::Node { }
/**
* A sanitizer for XML-bomb vulnerabilities.
*/
abstract class Sanitizer extends DataFlow::Node { }
/** A source of remote user input, considered as a flow source for XML bomb vulnerabilities. */
class RemoteFlowSourceAsSource extends Source {
RemoteFlowSourceAsSource() { this instanceof RemoteFlowSource }
}
/**
* An access to `document.location`, considered as a flow source for XML bomb vulnerabilities.
*/
class LocationAsSource extends Source, DataFlow::ValueNode {
LocationAsSource() { isLocation(astNode) }
}
/**
* A call to an XML parser that performs internal entity expansion, viewed
* as a data flow sink for XML-bomb vulnerabilities.
*/
class XmlParsingWithEntityResolution extends Sink, DataFlow::ValueNode {
XmlParsingWithEntityResolution() {
exists(XML::ParserInvocation parse | astNode = parse.getSourceArgument() |
parse.resolvesEntities(XML::InternalEntity())
)
}
}
}