Vulnerabilities in pkg:golang/github.com/datacharmer/dbdeployer
PACKAGECVE-2020-26277 is a MODERATE (CVSS 6.1) symbolic links vulnerability (CWE-59: Improper Link Resolution Before File Access ('Link Following')) affecting Github.com/datacharmer/dbdeployer libraries in the Go ecosystem. The issue involves symbolic links in an unpacking routine may enable attackers to read and/or write to arbitrary locations in dbdeployer. Remediation is available by upgrading affected packages to version 1.58.2.
pkg:golang/github.com/datacharmer/dbdeployer
Vulnerability advisories affecting package pkg:golang/github.com/datacharmer/dbdeployer. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-47wr-426j-fr82 | CVE-2020-26277 | MODERATE | Symbolic links in an unpacking routine may enable attackers to read and/or write to arbitrary locations in dbdeployer |
CVE-2020-26277 at a Glance
Security Impact
CVSS: 6.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N).
How to Fix CVE-2020-26277
To remediate this vulnerability, upgrade all affected Github.com/datacharmer/dbdeployer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/datacharmer/dbdeployer to 1.58.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/datacharmer/dbdeployer
How to Check if You Are Affected
To determine whether your application is affected by CVE-2020-26277, inspect your project dependencies for Github.com/datacharmer/dbdeployer:
inspect dependencies for github.com/datacharmer/dbdeployer
Analyze the terminal output to locate any version of Github.com/datacharmer/dbdeployer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.58.2), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-59: Improper Link Resolution Before File Access ('Link Following'), where the product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource. In Github.com/datacharmer/dbdeployer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2020-26277 Affected Github.com/datacharmer/dbdeployer Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/datacharmer/dbdeployer
|
Go |
< 1.58.2
|
1.58.2
|
References
Frequently Asked Questions
What is CVE-2020-26277?
Which Github.com/datacharmer/dbdeployer versions are affected?
What version fixes CVE-2020-26277?
Is github.com/datacharmer/dbdeployer affected?
What is the CVSS score of CVE-2020-26277?
What CWE is associated with CVE-2020-26277?
How can I check Go dependencies for CVE-2020-26277?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-47wr-426j-fr82",
"modified" : "2021-05-21T18:35:39Z",
"published" : "2022-02-12T00:14:07Z",
"aliases" : [ "CVE-2020-26277" ],
"summary" : "Symbolic links in an unpacking routine may enable attackers to read and/or write to arbitrary locations in dbdeployer",
"details" : "### Impact\n_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._\n\n### Mitigating factors\nFor the attach to succeed, the following factors need to contribute:\n\n* The user is logged in as root. While dbdeployer is usable as root, it was designed to run as unprivileged user.\n* 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.\n\n### Analysis\n\nAn 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.\nAs 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.\nAs noted above, the user must have write privileges to the target file to do the damage.\n\n### Remedies\n\nIt 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.\nA 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.\n\nAn 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:\n\n```\nUnpacking tarball exploit/mysql-8.0.22-macos10.15-x86_64.tar.gz to $HOME/opt/mysql/test8.0.22\n......\nlink '../../../../../../../../../../etc' points outside target directory\n\nexit status 1\n```\nAs 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.\n\nThe same check can be applied to a link to a non existing file with absolute path.\n\n### Patches\n\nPatched in release 1.58.2\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [dbdeployer](https://github.com/datacharmer/dbdeployer)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:N/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/datacharmer/dbdeployer"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.58.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/datacharmer/dbdeployer/security/advisories/GHSA-47wr-426j-fr82"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-26277"
}, {
"type" : "WEB",
"url" : "https://github.com/datacharmer/dbdeployer/commit/548e256c1de2f99746e861454e7714ec6bc9bb10"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-59" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-05-21T18:35:39Z",
"nvd_published_at" : "2020-12-21T22:15:00Z"
}
}