Headline
CVE-2023-37477: fix: 解决部分接口命令注入问题 (#1690) · 1Panel-dev/1Panel@e17b80c
1Panel is an open source Linux server operation and maintenance management panel. An OS command injection vulnerability exists in 1Panel firewall functionality. A specially-crafted HTTP request can lead to arbitrary command execution. An attacker can make an authenticated HTTP request to trigger this vulnerability. 1Panel firewall functionality /hosts/firewall/ip
endpoint read user input without validation, the attacker extends the default functionality of the application, which execute system commands. An attacker can execute arbitrary code on the target system, which can lead to a complete compromise of the system. This issue has been addressed in commit e17b80cff49
which is included in release version 1.4.3
. Users are advised to upgrade. There are no known workarounds for this vulnerability.
Expand Up @@ -14,8 +14,10 @@ import (
“github.com/1Panel-dev/1Panel/backend/app/dto” “github.com/1Panel-dev/1Panel/backend/app/model” “github.com/1Panel-dev/1Panel/backend/buserr” “github.com/1Panel-dev/1Panel/backend/constant” “github.com/1Panel-dev/1Panel/backend/global” “github.com/1Panel-dev/1Panel/backend/utils/cmd” “github.com/1Panel-dev/1Panel/backend/utils/compose” “github.com/1Panel-dev/1Panel/backend/utils/docker” “github.com/docker/docker/api/types” Expand Down Expand Up @@ -127,6 +129,9 @@ func (u *ContainerService) PageCompose(req dto.SearchWithPage) (int64, interface }
func (u *ContainerService) TestCompose(req dto.ComposeCreate) (bool, error) { if cmd.CheckIllegal(req.Path) { return false, buserr.New(constant.ErrCmdIllegal) } composeItem, _ := composeRepo.GetRecord(commonRepo.WithByName(req.Name)) if composeItem.ID != 0 { return false, constant.ErrRecordExist Expand All @@ -143,6 +148,9 @@ func (u *ContainerService) TestCompose(req dto.ComposeCreate) (bool, error) { }
func (u *ContainerService) CreateCompose(req dto.ComposeCreate) (string, error) { if cmd.CheckIllegal(req.Name, req.Path) { return "", buserr.New(constant.ErrCmdIllegal) } if err := u.loadPath(&req); err != nil { return "", err } Expand Down Expand Up @@ -177,6 +185,9 @@ func (u *ContainerService) CreateCompose(req dto.ComposeCreate) (string, error) }
func (u *ContainerService) ComposeOperation(req dto.ComposeOperation) error { if cmd.CheckIllegal(req.Path, req.Operation) { return buserr.New(constant.ErrCmdIllegal) } if _, err := os.Stat(req.Path); err != nil { return fmt.Errorf("load file with path %s failed, %v", req.Path, err) } Expand All @@ -195,6 +206,9 @@ func (u *ContainerService) ComposeOperation(req dto.ComposeOperation) error { }
func (u *ContainerService) ComposeUpdate(req dto.ComposeUpdate) error { if cmd.CheckIllegal(req.Name, req.Path) { return buserr.New(constant.ErrCmdIllegal) } if _, err := os.Stat(req.Path); err != nil { return fmt.Errorf("load file with path %s failed, %v", req.Path, err) } Expand Down
Related news
### Summary An OS command injection vulnerability exists in 1Panel firewall functionality. A specially-crafted HTTP request can lead to arbitrary command execution. An attacker can make an authenticated HTTP request to trigger this vulnerability. ### Details 1Panel firewall functionality `/hosts/firewall/ip` endpoint read user input without validation, the attacker extends the default functionality of the application, which execute system commands. ### PoC the payload `; sleep 3 #` will lead server response in 3 seconds ![image](https://user-images.githubusercontent.com/4935500/252299676-bc4a8b92-e475-40ee-a92a-fec9fad7a6c3.png) the payload `; sleep 6 #` will lead server response in 6 seconds ![image](https://user-images.githubusercontent.com/4935500/252299871-766cc411-69e5-4c6c-b4ff-7774fa974ea0.png) ### Impact An attacker can execute arbitrary code on the target system, which can lead to a complete compromise of the system. ### Patches The vulnerability has been fixed in v1.4...