Advanced Bash-Scripting Guide Example Script getopt_simple access control
| CVSS Meta Temp Score | Current Exploit Price (≈) | CTI Interest Score |
|---|---|---|
| 6.6 | $0-$5k | 0.00 |
Summary
A vulnerability was found in Advanced Bash-Scripting Guide Example Script. It has been classified as critical. Affected by this vulnerability is the function getopt_simple. The manipulation leads to access control.
This vulnerability is listed as CVE-2019-9891. The attack must be carried out locally. In addition, an exploit is available. This vulnerability has a historic impact because of its background and how it was received.
It is advisable to use the suggested workaround.
Details
A vulnerability, which was classified as critical, has been found in Advanced Bash-Scripting Guide Example Script (unknown version). This issue affects the function getopt_simple. The manipulation with an unknown input leads to a access control vulnerability. Using CWE to declare the problem leads to CWE-264. Impacted is confidentiality, integrity, and availability. The summary by CVE is:
The function getopt_simple as described in Advanced Bash Scripting Guide (ISBN 978-1435752184) allows privilege escalation and execution of commands when used in a shell script called, for example, via sudo.
The bug was discovered 02/18/2019. The weakness was presented 03/26/2019 by RedTeam Pentesting (Patrick) with RedTeam Pentesting GmbH as [RT-SA-2019-007] Code Execution via Insecure Shell Function getopt_simple as not defined mailinglist post (Bugtraq). The advisory is shared at seclists.org. The identification of this vulnerability is CVE-2019-9891 since 03/20/2019. An attack has to be approached locally. The requirement for exploitation is a simple authentication. Technical details as well as a public exploit are known. The price for an exploit might be around USD $0-$5k at the moment (estimation calculated on 05/21/2020). MITRE ATT&CK project uses the attack technique T1068 for this issue. Due to its background and reception, this vulnerability has a historic impact. The following code is the reason for this vulnerability:
#!/bin/bash
getopt_simple()
{
until [ -z "$1" ]
do
if [ ${1:0:2} = '--' ]
then
tmp=${1:2} # Strip off leading '--' . . .
parameter=${tmp%%=*} # Extract name.
value=${tmp##*=} # Extract value.
eval $parameter=$value
fi
shift
done
}
target=/tmp
# Pass all options to getopt_simple().
getopt_simple $*
# list files to clean
echo "listing files in $target"
find "$target" -mtime 1This is an interesting vulnerability because it does not affect an actual software implementation but an example script in a programming tutorial.A public exploit has been developed by RedTeam Pentesting and been published immediately after the advisory. The exploit is available at seclists.org. It is declared as proof-of-concept. The vulnerability was handled as a non-public zero-day exploit for at least 2546 days. During that time the estimated underground price was around $0-$5k. The code used by the exploit is:
$ sudo -l
Matching Defaults entries for user on srv:
env_reset, secure_path=/usr/sbin\:/usr/bin\:/sbin\:/bin
User www-data may run the following commands on srv:
(root) NOPASSWD: /usr/local/sbin/cleanup.sh The best possible mitigation is suggested to be Workaround. The mailinglist post contains the following remark:
Replace the function "getopt_simple" with the built-in function "getopts" or the program "getopt" from the util-linux package. Examples on how to do so are included in the same tutorial [3][4].
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Product
Vendor
Name
CPE 2.3
CPE 2.2
CVSSv4
VulDB Vector: 🔍VulDB Reliability: 🔍
CVSSv3
VulDB Meta Base Score: 7.6VulDB Meta Temp Score: 7.2
VulDB Base Score: 5.3
VulDB Temp Score: 4.7
VulDB Vector: 🔍
VulDB Reliability: 🔍
NVD Base Score: 9.8
NVD Vector: 🔍
CVSSv2
| AV | AC | Au | C | I | A |
|---|---|---|---|---|---|
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| Vector | Complexity | Authentication | Confidentiality | Integrity | Availability |
|---|---|---|---|---|---|
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
VulDB Base Score: 🔍
VulDB Temp Score: 🔍
VulDB Reliability: 🔍
NVD Base Score: 🔍
Exploiting
Class: Access controlCWE: CWE-264
CAPEC: 🔍
ATT&CK: 🔍
Physical: Partially
Local: Yes
Remote: Yes
Availability: 🔍
Access: Public
Status: Proof-of-Concept
Author: RedTeam Pentesting
Download: 🔍
EPSS Score: 🔍
EPSS Percentile: 🔍
Price Prediction: 🔍
Current Price Estimation: 🔍
| 0-Day | Unlock | Unlock | Unlock | Unlock |
|---|---|---|---|---|
| Today | Unlock | Unlock | Unlock | Unlock |
Threat Intelligence
Interest: 🔍Active Actors: 🔍
Active APT Groups: 🔍
Countermeasures
Recommended: WorkaroundStatus: 🔍
0-Day Time: 🔍
Exploit Delay Time: 🔍
Timeline
04/05/2012 🔍02/18/2019 🔍
03/20/2019 🔍
03/20/2019 🔍
03/20/2019 🔍
03/26/2019 🔍
03/26/2019 🔍
03/27/2019 🔍
05/21/2020 🔍
Sources
Advisory: [RT-SA-2019-007] Code Execution via Insecure Shell Function getopt_simpleResearcher: RedTeam Pentesting (Patrick)
Organization: RedTeam Pentesting GmbH
Status: Not defined
CVE: CVE-2019-9891 (🔍)
GCVE (CVE): GCVE-0-2019-9891
GCVE (VulDB): GCVE-100-132473
scip Labs: https://www.scip.ch/en/?labs.20161013
Entry
Created: 03/27/2019 08:39Updated: 05/21/2020 20:23
Changes: 03/27/2019 08:39 (73), 05/21/2020 20:23 (2)
Complete: 🔍
Cache ID: 216:172:103
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
No comments yet. Languages: en.
Please log in to comment.