GHSL-2023-064: Cross-Site Request Forgery (CSRF) and Server-Side Request Forgery (SSRF) in jenkinsci/pipeline-restful-api-plugin - CVE-2023-37957
The Jenkins plugin's token generation endpoint lacked CSRF protection and allowed an attacker to specify a callback URL, so a crafted link could make a logged-in victim send their API token to an attacker-controlled server. The attacker could then use that token to impersonate the victim.
Originally disclosed on GitHub Security Lab
A Cross-Site Request Forgery (CSRF) and a Server-Side Request Forgery (SSRF) vulnerabilities in jenkinsci/pipeline-restful-api-plugin may allow an attacker to retrieve a token to impersonate its victim.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the token generation endpoint did not require a CSRF token and accepted an arbitrary callback URL, allowing the generated token to be sent to an attacker-controlled server.
Impact
This could lead to sensitive credential leakage, account takeover, and remote code execution.
What the attacker needed
Victim is authenticated to Jenkins; victim visits attacker-crafted link
How it was found
- The attacker prepares a URL that points to the Jenkins instance's token generation endpoint and sets the callback parameter to an attacker-controlled server.
- The attacker sends this link to a victim who is logged in to Jenkins.
- When the victim visits the link, Jenkins generates a new API token for the victim and sends it via a POST request to the attacker's server.
- The attacker receives the token and uses it with the JCLI tool to impersonate the victim.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is a web security bug in a Jenkins plugin. When a logged-in user visits a special link, their browser automatically sends a request to the Jenkins server that creates a new API token. Because the request has no protection against being triggered from another site, and because the attacker can choose where the token is sent, the token ends up on the attacker's server. The attacker can then use that token to act as the victim.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.