CVE-2020-26277
JSON

6.1medium

Arbitrary read/write in DBdeployer

Severity
6.1medium CVSS:3.1 by GitHub_M
Exploit likelihood
1.20% (higher than 69% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-47wr-426j-fr82GO-2022-0787

Description

DBdeployer is a tool that deploys MySQL database servers easily. In DBdeployer before version 1.58.2, users unpacking a tarball may use a maliciously packaged tarball that contains symlinks to files external to the target. In such scenario, an attacker could induce dbdeployer to write into a system file, thus altering the computer defenses. For the attack to succeed, the following factors need to contribute: 1) The user is logged in as root. While dbdeployer is usable as root, it was designed to run as unprivileged user. 2) The user has taken a tarball from a non secure source, without testing the checksum. When the tarball is retrieved through dbdeployer, the checksum is compared before attempting to unpack. This has been fixed in version 1.58.2.

Affected

Product or packageVersionsReported by
datacharmer dbdeployer< 1.58.2CVE List
github.com/datacharmer/dbdeployer (Go)before 1.58.2GitHub Advisory Database, Go Vulnerability Database
dbdeployer dbdeployerbefore 1.58.2NVD

All scores

GitHub_M6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N
GitHub6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N
NVD4.0medium CVSS:2.0AV:N/AC:H/Au:N/C:N/I:P/A:P

Classification

What each source says

CVE List

DBdeployer is a tool that deploys MySQL database servers easily. In DBdeployer before version 1.58.2, users unpacking a tarball may use a maliciously packaged tarball that contains symlinks to files external to the target. In such scenario, an attacker could induce dbdeployer to write into a system file, thus altering the computer defenses. For the attack to succeed, the following factors need to contribute: 1) The user is logged in as root. While dbdeployer is usable as root, it was designed to run as unprivileged user. 2) The user has taken a tarball from a non secure source, without testing the checksum. When the tarball is retrieved through dbdeployer, the checksum is compared before attempting to unpack. This has been fixed in version 1.58.2.

GitHub Advisory Database
Impact

Users unpacking a tarball through dbdeployer may use a maliciously packaged tarball that contains symlinks to files external to the target. In such scenario, an attacker could induce dbdeployer to write into a system file, thus altering the computer defences.

Mitigating factors

For the attach to succeed, the following factors need to contribute:

  • The user is logged in as root. While dbdeployer is usable as root, it was designed to run as unprivileged user.
  • The user has taken a tarball from a non secure source, without testing the checksum. When the tarball is retrieved through dbdeployer, the checksum is compared before attempting to unpack.
Analysis

An attacker could inject a symbolic link into the tarball, so that a file could result into fake_file -> /etc/passwd or some equally important file. As it is now, dbdeployer would create the symlink as defined, with a local file fake_file linked to /etc/passwd. The danger here is that any process with the privileges to write to both fake_file and /etc/passwd could overwrite the system file. Even without malicious intent, this could result in the system to become unusable. As noted above, the user must have write privileges to the target file to do the damage.

Remedies

It has been suggested that the extract procedure use filepath.EvalSymlinks to determine whether the target is within the extraction directory. Unfortunately, this approach is unavailable in this context, because it would prevent legitimate patterns from being carried out. A simple case is a file mysql-8.0.22-macos10.15-x86_64/bin/libprotobuf-lite.3.11.4.dylib with a linkName ../lib/libprotobuf-lite.3.11.4.dylib, if the linked file has not been created yet, filepath.EvalSymlinks would fail, as it acts on existing files only.

An alternative method is comparing the depth (how many directories) of the file name with the depth of the link name. If the link name has a higher depth than the local file, we block the operation with an appropriate error:

Unpacking tarball exploit/mysql-8.0.22-macos10.15-x86_64.tar.gz to $HOME/opt/mysql/test8.0.22
......
link '../../../../../../../../../../etc' points outside target directory

exit status 1

As an additional fortifier, we can check whether the link points to an existing file, calculate its absolute name, and compare it with the absolute name of the extraction directory. A link to a full path (such as /etc/passwd) would fail this test, and trigger an error.

The same check can be applied to a link to a non existing file with absolute path.

Patches

Patched in release 1.58.2

For more information

If you have any questions or comments about this advisory:

Go Vulnerability Database

Symbolic links in an unpacking routine may enable attackers to read and/or write to arbitrary locations in dbdeployer in github.com/datacharmer/dbdeployer

NVD (es)

DBdeployer es una herramienta que despliega servidores de bases de datos MySQL fácilmente.&#xa0;En DBdeployer versiones anteriores a 1.58.2, los usuarios que descomprimen un tarball pueden usar un tarball paquetizado maliciosamente que contiene enlaces simbólicos para archivos externos al objetivo.&#xa0;En tal escenario, un atacante podría inducir a dbdeployer a escribir en un archivo del sistema, alterando así las defensas del ordenador.&#xa0;Para que el ataque tenga éxito, los siguientes factores deben contribuir: 1) El usuario está registrado como root.&#xa0;Si bien dbdeployer puede ser usado como root, fue diseñado para ejecutarse como un usuario sin privilegios.&#xa0;2) El usuario ha tomado un tarball de una fuente no segura, sin probar el checksum.&#xa0;Cuando el tarball se recupera por medio de dbdeployer, el checksum se compara antes de intentar desempaquetar.&#xa0;Esto se ha abordado en la versión 1.58.2

References

Sources

SourceRecordLicence
CVE ListCVE-2020-26277 changed 2024-08-04CVE Terms of Use
GitHub Advisory DatabaseGHSA-47wr-426j-fr82 changed 2026-07-08CC-BY-4.0
Go Vulnerability DatabaseGO-2022-0787 changed 2026-03-03CC-BY-4.0
NVDCVE-2020-26277 changed 2026-06-17Public domain