7.8 High
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
6.8 Medium
CVSS2
Access Vector
NETWORK
Access 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
Archive_Tar through 1.4.10 allows an unserialization attack because phar: is blocked but PHAR: is not blocked.
Recent assessments:
gwillcox-r7 at January 15, 2021 7:39pm UTC reported:
Edit: PoC code for this can be found at <https://github.com/pear/Archive_Tar/issues/33> along with the original advisory.
An interesting vulnerability using the concepts of PHAR file deserialization as first discussed at BlackHat in this video: <https://www.youtube.com/watch?v=OrEar0TiS90>. For those who donβt know, the phar://
file stream handler allows opening PHAR files, which are basically PHP archive files containing a bunch of related files (mostly tends to be PHP files within the archive, but can be other things as well). Whats interesting about PHAR files is that their metadata is formed via a serialize()
call when their created, and when files are extracted, unserialize()
will automatically be called on that metadata string. This leads to the potential for serialization attacks even when the application doesnβt explicitly use unserialize()
calls.
In this case, the Archive_Tar developers were aware of this prior research and attempted to explicitly block phar://
, ../
, and ..\
within any file name contained with the tar
archive by performing a strpos
call using these strings and erroring out if the string contained these characters. Unfortunately that check is really poor for a number of reasons.
The specific reason related to this CVE, aka CVE-2020-28948, is that users can simply use PHAR://
to bypass this check. In other words, the check performed by strpos()
is not case sensitive, so one can easily bypass it by simply changing the case of the string. They could also mix the case, so an example like pHaR://
might also work.
This then allows attackers to perform attacks where they can load a local PHAR file on the target system and use a deserialization attack to perform some malicious action. Assuming an app is already extracting the contents of the TAR files locally, an attacker would simply have to upload a TAR file containing a malicious PHAR file and have the app extract and save the PHAR file locally, after which they could upload a second TAR file containing a file named PHAR://*malicious PHAR file location*
and the PHP app would attempt to access and extract the local PHAR file, thereby triggering the vulnerability.
Notice that the PHAR://
file handler does not allow for accessing remote files, which is why this procedure is required.
Research into deserialization gadgets for this exploit showed that most of the potential possibilities seem mostly restricted to file operations. The PoC showed that it would be possible to delete a file using this vulnerability but I was not able to determine any other useful actions that could be performed. Potential impact would depend both on the privileges of the user running PHP as well as what operations the app was doing; again remember the program will only be able to do file operations so most likely an attacker would have to package a malicious PHP file within the PHAR archive, have that be extracted somehow along with the malicious PHAR file, and then also have a file within the TAR archive that has a filename of PHAR://*path to malicious PHAR archive that was uploaded*
to form a full end to end payload and get RCE.
Overall Iβd say this is an interesting bug but its exploitability is somewhat limited and depends highly on the underlying application it is used within.
Assessed Attacker Value: 3
Assessed Attacker Value: 3Assessed Attacker Value: 4
cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-28948
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/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/
security.gentoo.org/glsa/202101-23
www.debian.org/security/2020/dsa-4817
www.drupal.org/sa-core-2020-013
7.8 High
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
6.8 Medium
CVSS2
Access Vector
NETWORK
Access 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