CVSS2
Attack Vector
NETWORK
Attack Complexity
MEDIUM
Authentication
NONE
Confidentiality Impact
PARTIAL
Integrity Impact
PARTIAL
Availability Impact
PARTIAL
AV:N/AC:M/Au:N/C:P/I:P/A:P
CVSS3
Attack Vector
LOCAL
Attack Complexity
LOW
Privileges Required
NONE
User Interaction
REQUIRED
Scope
UNCHANGED
Confidentiality Impact
HIGH
Integrity Impact
HIGH
Availability Impact
HIGH
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
AI Score
Confidence
High
EPSS
Percentile
99.3%
Archive_Tar through 1.4.10 has :// filename sanitization only to address phar attacks, and thus any other stream-wrapper attack (such as file:// to overwrite files) can still succeed.
Recent assessments:
gwillcox-r7 at January 15, 2021 8:42pm UTC reported:
Original advisory and PoC can be found at <https://github.com/pear/Archive_Tar/issues/33>
This vulnerability is very similar to CVE-2020-28948, with a couple of key differences. In the case of CVE-2020-28948, the root issue was that the code within Archive_Tar didn’t use case sensitive checks to ensure file names didn’t start with phar://
. Here the issue is the same however it stems from a lack of checks. More specifically as mentioned in my writeup on CVE-2020-28948, Archive_Tar prior to 1.4.11 checked, using strpos()
, that filenames within a TAR archive did not start with the characters phar://
and did not contain the characters ../
or ..\
.
Notice however that there is a problem here: we can still use any other file stream wrapper other than the phar://
file handler within a file name to trigger the corresponding wrapper handler. A full list of PHP file stream wrappers can be found at <https://www.php.net/manual/en/wrappers.php>.
Looking at these stream wrappers reveals there are a few that might help with file writes. In fact, as shown in the PoC at <https://github.com/pear/Archive_Tar/issues/33>, if one creates a file within a TAR archive with a name such as file:///etc/passwd
, then when the TAR archive is extracted, the corresponding file, which in this case would be /etc/passwd
, will be overwritten with attacker controlled contents, assuming the user that PHP is running as has permissions to create or overwrite that file.
This leads to an arbitrary file upload vulnerability whereby an attacker could potentially overwrite existing files with arbitrary content. The attacker would however need to know the exact path on disk to the file that they wished to write: remember that ..\
and ../
are not allowed in filenames and even if they were, the file://
stream wrapper requires the use of absolute paths.
Again as noted in my writeup on CVE-2020-28948, this bug entirely depends on the fact that a vulnerable application makes use of this library and also extracts the contents of the TAR file as part of its operations. If the application only allows TAR file uploads but it doesn’t actually try to extract the contents of the TAR file as part of its operations, then this vulnerability will never be triggered.
That being said assuming an attacker does know the right path and the application is set up in to extract TAR files, then this can easily lead to RCE via overwriting existing PHP files on the target system.
Assessed Attacker Value: 4
Assessed Attacker Value: 4Assessed Attacker Value: 4
packetstormsecurity.com/files/161095/PEAR-Archive_Tar-Arbitrary-File-Write.html
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-28949
github.com/pear/Archive_Tar/issues/33
lists.debian.org/debian-lts-announce/2020/11/msg00045.html
lists.fedoraproject.org/archives/list/[email protected]/message/42GPGVVFTLJYAKRI75IVB5R45NYQGEUR/
lists.fedoraproject.org/archives/list/[email protected]/message/4V35LBRM6HBCXBVCITKQ4UEBTXO2EG7B/
lists.fedoraproject.org/archives/list/[email protected]/message/5KSFM672XW3X6BR7TVKRD63SLZGKK437/
lists.fedoraproject.org/archives/list/[email protected]/message/KWM4CTMEGAC4I2CHYNJVSROY4CVXVEUT/
lists.fedoraproject.org/archives/list/[email protected]/message/NBYZSHYTIOBK6V7C4N7TP6KIKCRKLVWP/
lists.fedoraproject.org/archives/list/[email protected]/message/VJQQYDAOWHD6RDITDRPHFW7WY6BS3V5N/
security.gentoo.org/glsa/202101-23
www.debian.org/security/2020/dsa-4817
www.drupal.org/sa-core-2020-013
CVSS2
Attack Vector
NETWORK
Attack Complexity
MEDIUM
Authentication
NONE
Confidentiality Impact
PARTIAL
Integrity Impact
PARTIAL
Availability Impact
PARTIAL
AV:N/AC:M/Au:N/C:P/I:P/A:P
CVSS3
Attack Vector
LOCAL
Attack Complexity
LOW
Privileges Required
NONE
User Interaction
REQUIRED
Scope
UNCHANGED
Confidentiality Impact
HIGH
Integrity Impact
HIGH
Availability Impact
HIGH
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
AI Score
Confidence
High
EPSS
Percentile
99.3%