Lucene search

K
exploitdbStephane ChazelasEDB-ID:34765
HistorySep 25, 2014 - 12:00 a.m.

GNU Bash - 'Shellshock' Environment Variable Command Injection

2014-09-2500:00:00
Stephane Chazelas
www.exploit-db.com
46

AI Score

7.4

Confidence

Low

EPSS

0.974

Percentile

99.9%

Exploit Database Note:
The following is an excerpt from: https://securityblog.redhat.com/2014/09/24/bash-specially-crafted-environment-variables-code-injection-attack/

Like β€œreal” programming languages, Bash has functions, though in a somewhat limited implementation, and it is possible to put these bash functions into environment variables. This flaw is triggered when extra code is added to the end of these function definitions (inside the enivronment variable). Something like:

$ env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
 vulnerable
 this is a test

The patch used to fix this flaw, ensures that no code is allowed after the end of a bash function. So if you run the above example with the patched version of bash, you should get an output similar to:

 $ env x='() { :;}; echo vulnerable' bash -c "echo this is a test"
 bash: warning: x: ignoring function definition attempt
 bash: error importing function definition for `x'
 this is a test