Skip to content

feat(java): detect UnprotectedRootAction JSON body parse without HMAC header (CWE-306) - #193

Open
ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/jenkins-unprotected-webhook-readvalue
Open

ai-anant wants to merge 1 commit into
CodeVigilant:mainfrom
ai-anant:rule/jenkins-unprotected-webhook-readvalue

Conversation

@ai-anant

Copy link
Copy Markdown

Summary

Adds a Jenkins Java rule that flags an UnprotectedRootAction handler which deserializes the HTTP request body with ObjectMapper.readValue(request.getInputStream(), ...) without first reading an HMAC/signature header (X-Hub-Signature / X-Hub-Signature-256).

UnprotectedRootAction skips Jenkins authentication. Parsing inbound JSON events with no shared-secret check lets any caller who can POST to the endpoint inject those events (CWE-306).

Pattern (generic)

  • Positive: class implements UnprotectedRootAction and calls ObjectMapper.readValue on StaplerRequest.getInputStream() with no prior getHeader("X-Hub-Signature") / X-Hub-Signature-256.
  • Negative: the same shape after reading X-Hub-Signature.

Test

Validated with semgrep --validate. Positive repro fires; sanitized negative (signature header read before readValue) is silent.

Notes

No plugin/project names, file paths, versions, or exploit details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant