
oss-sec mailing list archives
Re: shell wildcard expansion (un)safety
From: Eli Schwartz <eschwartz () gentoo org>
Date: Sat, 9 Nov 2024 18:59:01 -0500
On 11/8/24 5:02 PM, Dominik Czarnota wrote:
This is known since even earlier by the article/disclosure „unix wildcards gone wild”: https://seclists.org/fulldisclosure/2014/Jun/136 The original article link seems to not work but it can be seen e.g. here: https://github.com/Gandosha/gandosha.github.io/blob/master/DefenseCode_Unix_WildCards_Gone_Wild.txt It shows that in some cases this can lead to code execution, e.g. with „tar *”
The earliest version of the Bash Pitfalls guide that includes a warning about the topic, per the Wayback Machine: https://web.archive.org/web/20090426020027/https://mywiki.wooledge.org/BashPitfalls#Filenames_with_leading_dashes Overall, wildcards are just a classic "here is a programming language footgun, we cannot fix it because the language is backwards compatible to the 90s and earlier" which amounts to: people love bash because it's "simple" and "easy" and "anyone can write a bash script without knowing what they are doing". Of course, the problem is that people who don't know what they are doing can then write software (sometimes running as root, other times simply as any permission context with access to sensitive info), which is quite dangerous -- people who don't know what they are doing often write security vulnerabilities in many languages, but it's particularly easy to do so in a language that by definition lacks rigorous parsing, makes it challenging to have error conditions be fatal, and is for the most part designed to take any erroneous code you throw at it and do its best to execute as much of that code as it can, even if lots of it doesn't really parse correctly. ... wait a minute, are we talking about PHP after all? -- Eli Schwartz
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature
Current thread:
- Re: shell wildcard expansion (un)safety, (continued)
- Re: shell wildcard expansion (un)safety Steffen Nurpmeso (Nov 15)
- Re: shell wildcard expansion (un)safety lists (Nov 10)
- Re: shell wildcard expansion (un)safety Ali Polatel (Nov 12)
- Re: shell wildcard expansion (un)safety Sean Whitton (Nov 17)
- Re: shell wildcard expansion (un)safety Eli Schwartz (Nov 06)
- Re: shell wildcard expansion (un)safety Fay Stegerman (Nov 06)
- Re: shell wildcard expansion (un)safety Jakub Wilk (Nov 07)
- Re: shell wildcard expansion (un)safety Max Nikulin (Nov 07)
- Re: shell wildcard expansion (un)safety Georgi Guninski (Nov 08)
- Re: shell wildcard expansion (un)safety Dominik Czarnota (Nov 08)
- Re: shell wildcard expansion (un)safety Eli Schwartz (Nov 10)
- Re: shell wildcard expansion (un)safety Jeroen Roovers (Nov 10)
- Re: shell wildcard expansion (un)safety Fay Stegerman (Nov 10)
- Re: shell wildcard expansion (un)safety Dominik Czarnota (Nov 08)