Skip to content

[pulse][taint] add the servlet request accessors as sources and the cookie setters as propagators - #2287

Merged
dulmarod merged 1 commit into
meta:mainfrom
jeremydubreil:java-taint-request-accessors-cookie-setters
Oct 29, 2026
Merged

dulmarod merged 1 commit into
meta:mainfrom
jeremydubreil:java-taint-request-accessors-cookie-setters

Conversation

@jeremydubreil

Copy link
Copy Markdown
Contributor

The Endpoint source on the HttpServlet request handlers taints the request, and the values read from it are tainted through the default propagation of unknown calls. This is lost when the request goes through a field and a method analyzed on its own, as in a helper wrapping the request: the summary of the helper does not carry the taint of the caller's request. Make the values returned by the request accessors (getParameter, getHeader, getCookies, getQueryString, ...) Endpoint sources too, wherever the request comes from.

By default, an unknown instance method that returns void propagates the taint of its arguments to its receiver. For the attribute setters of Cookie (setPath, setMaxAge, ...), this taints the whole cookie, including its name and value, e.g. after
cookie.setPath(request.getRequestURI()). Declare these setters as propagators to their return value instead. setValue keeps the default propagation to the cookie.

On OWASP BenchmarkJava, this finds 32 more of its real vulnerabilities, for 8 more false positives, and removes 161 false cross-site scripting reports.

@meta-cla meta-cla Bot added the CLA Signed label Oct 28, 2026
…ookie setters as propagators

The `Endpoint` source on the `HttpServlet` request handlers taints the
request, and the values read from it are tainted through the default
propagation of unknown calls. This is lost when the request goes through
a field and a method analyzed on its own, as in a helper wrapping the
request: the summary of the helper does not carry the taint of the
caller's request. Make the values returned by the request accessors
(`getParameter`, `getHeader`, `getCookies`, `getQueryString`, ...)
`Endpoint` sources too, wherever the request comes from.

By default, an unknown instance method that returns `void` propagates
the taint of its arguments to its receiver. For the attribute setters of
`Cookie` (`setPath`, `setMaxAge`, ...), this taints the whole cookie,
including its name and value, e.g. after
`cookie.setPath(request.getRequestURI())`. Declare these setters as
propagators to their return value instead. `setValue` keeps the default
propagation to the cookie.

On OWASP BenchmarkJava, this finds 32 more of its real vulnerabilities,
for 8 more false positives, and removes 161 false cross-site scripting
reports.
@jeremydubreil
jeremydubreil force-pushed the java-taint-request-accessors-cookie-setters branch from 29a0681 to 3b94a50 Compare October 28, 2026 13:51
@dulmarod
dulmarod merged commit a7a510f into meta:main Oct 29, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants