Skip to content
This repository has been archived by the owner on May 28, 2024. It is now read-only.

Add protection from CSRF #291

Merged
merged 2 commits into from
Nov 7, 2023

Conversation

eduard-tita
Copy link
Collaborator

Nexus Platform plugin does not perform permission checks allowing user with Overall/Read permission to connect to an attacker-specified URL.

Two of the three endpoints also lead to a Credentials leaking due to the presence of the credentialsId parameter which can be used by an attacker to receive a request with username and password base64 encoded inside the headers as Basic Authentication.

Additionally, these HTTP endpoints do not require POST request, resulting in a cross-site request forgery (CSRF) vulnerability.

Culprit
NxiqConfiguration.groovy#L126
Nxrm2Configuration.groovy#L61
Nxrm3Configuration.groovy#L83

Recommendation

Links

Jira: https://sonatype.atlassian.net/browse/SEC-763
Build: https://jenkins.ci.sonatype.dev/job/integrations/job/jenkins/job/feature-snapshots/job/SEC-763-Vulnerabilities-Reported-by-Jenkins-Team/

@@ -58,6 +59,7 @@ class Nxrm2Configuration
}

@Override
@POST
FormValidation doVerifyCredentials(@QueryParameter String serverUrl, @QueryParameter String credentialsId)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on the specification, why would it not be necessary to check permissions for the user such as Jenkins.get().checkPermission(Jenkins.ADMINISTER);?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I'll add that too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See 1de6626

Copy link
Collaborator

@juanmafabbri juanmafabbri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 LGTM

@eduard-tita eduard-tita merged commit 1d5e1e9 into main Nov 7, 2023
12 of 13 checks passed
@eduard-tita eduard-tita deleted the SEC-763-Vulnerabilities-Reported-by-Jenkins-Team branch November 7, 2023 15:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants