-
Thanks for the report. Will get this addressed soon.
-
OneDev
changed state to 'Closed' 1 year ago
Previous Value Current Value Open
Closed
-
State changed as code fixing the issue is committed (bccaf576)
-
OneDev
changed state to 'Released' 1 year ago
Previous Value Current Value Closed
Released
-
State changed as build OD-5797 is successful
-
Previous Value Current Value true
false
-
Hi, Since the vulnerability can now be disclosed, I’ve updated the issue status from confidential to open.
-
@baiyecha404 nice find 👍
| Type |
Security Vulnerability
|
| Priority |
Major
|
| Assignee | |
| Labels |
No labels
|
Issue Votes (0)
Summary
Onedev provides users with CI/CD functionality, allowing them to select various pre-defined tasks for execution. The
Repository Sync / Pull from Remotejob is designed to perform pull operations from remote repositories, receiving parameters such asremoteUrlandrefs.In the creation panel, if an invalid
remoteUrlis submitted, the backend validation logic will display an error:Only http/https protocol is supported.However, by directly editing the
.onedev-buildspec.ymlfile, this check can be bypassed, allowing malicious parameters to be passed.Additionally, when Onedev executes commands, the basic command format is:
git fetch $remoteUrl $refs:refsThis means we can modify the
remoteUrlto--upload-pack=whoamito execute malicious commands.However, during command execution, other methods such as
getRemoteUrlWithCredentialare also invoked:This breaks the existing format, rendering many payloads unusable.
Ultimately, we can bypass this check by using a command format containing
//, as shown below:This results in a command injection, allowing attackers to execute arbitrary commands on the Onedev server.
Steps to Reproduce
Environment: Latest Docker version
1dev/server:11.6.6Log in with a user who has
code writerpermissions for a project.Add a
.onedev-buildspec.ymlfile to the project.Construct a payload for the desired command execution. For example, to execute
touch /tmp/aaa, first encode the command in base64:dG91Y2ggL3RtcC9hYWEK.The command to execute would be:
echo dG91Y2ggL3RtcC9hYWEK |base64 -d|bash -i.The final
.onedev-buildspec.ymlcontent would be:Save and execute the job. The command will execute successfully.
Check the container to verify the created file.