# \*nix bash shell bug

**URL:** <https://forum.fairphone.com/t/nix-bash-shell-bug/1691>\
**Category:** The Products\
**Created:** [September 25, 2014, 7:32am UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691 "2014-09-25T07:32:05Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![kgha](https://forum.fairphone.com/letter_avatar/kgha/32/6_449c533f586939b6e5f246632a46421f.png) [@kgha](https://forum.fairphone.com/u/kgha)\
**Post date:** [September 25, 2014, 7:32am UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/1 "2014-09-25T07:32:05Z")

</div>

Some of you may have read the headlines reporting of a newfound bug in most \*nix systems (which includes Linux, MacOS, Android) that may open systems to vulnerable exploit.

As I understand it, no Android device has a bash shell installed by default. But since the FP is rooted, and clearly a lot of FP users like prodding the system, some of you may have installed a bash shell app. If you’re among them, I guess it is prudent to take caution and patch your batch package.

It would be great if someone more savvy could confirm that ‘ordinary users’ have no reason to worry.

Greetings from Karl (who has patched his Linux netbook…)

---

<div class="post-metadata">

**Author:** ![madde](https://forum.fairphone.com/user_avatar/forum.fairphone.com/madde/32/86_2.png) [@madde](https://forum.fairphone.com/u/madde)\
**Post date:** [September 25, 2014, 8:53am UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/2 "2014-09-25T08:53:58Z")

</div>

Does this help you? [https://apple.stackexchange.com/questions/146849/how-do-i-recompile-bash-to-avoid-the-remote-exploit-cve-2014-6271-and-cve-2014-7/146851#146851](https://apple.stackexchange.com/questions/146849/how-do-i-recompile-bash-to-avoid-the-remote-exploit-cve-2014-6271-and-cve-2014-7/146851#146851)

Sure, you’re patched alright? My Fedora still seems to be vulnerable.

For Busybox on Android see here: [https://twitter.com/tehowe/status/514859890662440961/photo/1](https://twitter.com/tehowe/status/514859890662440961/photo/1)

Edit: You might get some good answers here: [http://forum.xda-developers.com/fairphone/help](http://forum.xda-developers.com/fairphone/help)

---

<div class="post-metadata">

**Author:** ![madde](https://forum.fairphone.com/user_avatar/forum.fairphone.com/madde/32/86_2.png) [@madde](https://forum.fairphone.com/u/madde)\
**Post date:** [September 25, 2014, 9:25am UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/3 "2014-09-25T09:25:47Z")

</div>

Shellshock seems to be an issue with Cyanogenmod.

![](https://forum.fairphone.com/uploads/default/573/8a2b043b18175ab7.png)

---

<div class="post-metadata">

**Author:** ![kgha](https://forum.fairphone.com/letter_avatar/kgha/32/6_449c533f586939b6e5f246632a46421f.png) [@kgha](https://forum.fairphone.com/u/kgha)\
**Post date:** [September 25, 2014, 10:31am UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/4 "2014-09-25T10:31:17Z")

</div>

> [@madde](#):
>
> Sure, you’re patched alright? My Fedora still seems to be vulnerable

Hi madde and thanks for the input. Yup, I found a patched bash package on a reliable repo out there (I’m on a slackware-based distro) and after installing the test script shows that I’m protected.

Found this information for Fedora users:

> **[Flaw CVE-2014-6271 discovered in the Bash shell - update your Fedora systems...](https://fedoramagazine.org/flaw-discovered-in-the-bash-shell-update-your-fedora-systems/)**
>
> UPDATE: the packages mentioned in this post contained an incomplete fix. See this newer post for more details and how to get the updated packages that contain the fix The Red Hat security blog just posted a detailed article on the recently discovered...

- there are patched bash package updates available for F19, 20, 21.

But I still wonder if the vulnerability affects a stock Android install? Is there a hidden bash shell behind the curtains? Or does this only affect Android users who have installed a bash shell app?

---

<div class="post-metadata">

**Author:** ![Stefan](https://forum.fairphone.com/user_avatar/forum.fairphone.com/stefan/32/4254_2.png) [@Stefan](https://forum.fairphone.com/u/Stefan)\
**Post date:** [September 25, 2014, 10:37am UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/5 "2014-09-25T10:37:28Z")

</div>

I installed Terminal Emulator from F-Droid on my FP OS, is it vulnerable, and how can I check this?

---

<div class="post-metadata">

**Author:** ![kgha](https://forum.fairphone.com/letter_avatar/kgha/32/6_449c533f586939b6e5f246632a46421f.png) [@kgha](https://forum.fairphone.com/u/kgha)\
**Post date:** [September 25, 2014, 10:59am UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/6 "2014-09-25T10:59:48Z")

</div>

> [@Stefan](#):
>
> I installed Terminal Emulator from F-Droid on my FP OS, is it vulnerable, and how can I check this?

give the following command in the terminal (from first link in madde’s first post):

env x=‘() { :;}; echo vulnerable’ bash -c ‘echo hello’

If vulnerable, you’ll get the output

vulnerable  
hello

(as shown in madde’s second post)

If not, the output is

bash: warning: x: ignoring function definition attempt  
bash: error importing function definition for `x’  
hello

(or maybe something completely different. Not sure about what Terminal Emulator can do. Maybe it doesn’t include a bash shell?)

---

<div class="post-metadata">

**Author:** ![Dominik](https://forum.fairphone.com/letter_avatar/dominik/32/6_449c533f586939b6e5f246632a46421f.png) [@Dominik](https://forum.fairphone.com/u/Dominik)\
**Post date:** [September 25, 2014, 1:10pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/7 "2014-09-25T13:10:41Z")

</div>

Android ships the [MirBSD Korn shell (mksh)](https://www.mirbsd.org/mksh.htm) ([Android source](https://android.googlesource.com/platform/external/mksh/), see also [good mksh introduction for Android, “mksh vs. bash”](http://www.all-things-android.com/content/mirbsd-korn-shell-android-shell) ). It is [standard (at least) since 4.0](http://stackoverflow.com/a/18844732/1168315).

To see which shell your emulator is using, I suggest this commands as tests:

- _mksh_  
`$ print $KSH_VERSION`  
outputs  
`@(#)MIRBSD KSH R40 2011/10/07` (at mine)
- _bash_  
`$ bash --version`  
should output  
`GNU bash, Version [...]`

### (Android) Terminal Emulator App

The [_Terminal Emulator_ App](https://github.com/jackpal/Android-Terminal-Emulator) ships with `/system/bin/sh -` as default shell (tested with version from F-Droid). So it emulates _mksh_. You can  
find the used shell in the preferences.

---

<div class="post-metadata">

**Author:** ![kgha](https://forum.fairphone.com/letter_avatar/kgha/32/6_449c533f586939b6e5f246632a46421f.png) [@kgha](https://forum.fairphone.com/u/kgha)\
**Post date:** [September 25, 2014, 1:26pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/8 "2014-09-25T13:26:03Z")

</div>

> [@Dominik](#):
>
> Android ships the MirBSD Korn shell (mksh) (Android source, see also good mksh introduction for Android, “mksh vs. bash”). It is standard (at least) since 4.0.

…meaning that, unless I’ve installed another shell, my FP won’t be affected by the ‘Shellshock’ (bash shell) bug - am I right when inferring this?

---

<div class="post-metadata">

**Author:** ![Stefan](https://forum.fairphone.com/user_avatar/forum.fairphone.com/stefan/32/4254_2.png) [@Stefan](https://forum.fairphone.com/u/Stefan)\
**Post date:** [September 25, 2014, 2:51pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/9 "2014-09-25T14:51:17Z")

</div>

Thank you @Dominik for clarifying this. I did not know that there were more than one shells.

@kgha I tested the command _env_ but it wasn’t found by the shell. So I think it does not work with mksh. On the other hand it tells me that Cyanogenmod uses bash and is vulnerable. Is that right? (@madde)

---

<div class="post-metadata">

**Author:** ![madde](https://forum.fairphone.com/user_avatar/forum.fairphone.com/madde/32/86_2.png) [@madde](https://forum.fairphone.com/u/madde)\
**Post date:** [September 25, 2014, 2:55pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/10 "2014-09-25T14:55:04Z")

</div>

> [@kgha](#):
>
> …meaning that, unless I’ve installed another shell, my FP won’t be affected by the ‘Shellshock’ (bash shell) bug - am I right when inferring this?

What exactly did you test? Screenshot would be helpful. I would be very surprised if mksh wouldn’t know env…

---

<div class="post-metadata">

**Author:** ![Stefan](https://forum.fairphone.com/user_avatar/forum.fairphone.com/stefan/32/4254_2.png) [@Stefan](https://forum.fairphone.com/u/Stefan)\
**Post date:** [September 25, 2014, 3:01pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/11 "2014-09-25T15:01:10Z")

</div>

![](https://forum.fairphone.com/uploads/default/574/013f83a2af61e245.png)

---

<div class="post-metadata">

**Author:** ![kgha](https://forum.fairphone.com/letter_avatar/kgha/32/6_449c533f586939b6e5f246632a46421f.png) [@kgha](https://forum.fairphone.com/u/kgha)\
**Post date:** [September 25, 2014, 3:06pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/12 "2014-09-25T15:06:07Z")

</div>

I get a similar message:  
/system/bin/sh: [2]: env: not found

(using another terminal emulator)

But, honestly, I’m not that eager to peek under the bonnet… I just wonder if Shellshock affects a bog standard Android system? Can’t find anything authoritative on the web, although there are a few threads suggesting/arguing that Android is indeed not affected unless you’ve installed a GNU/bash app, see e.g. [https://news.ycombinator.com/item?id=8365110](https://news.ycombinator.com/item?id=8365110) or [http://lcamtuf.blogspot.se/2014/09/quick-notes-about-bash-bug-its-impact.html](http://lcamtuf.blogspot.se/2014/09/quick-notes-about-bash-bug-its-impact.html)

---

<div class="post-metadata">

**Author:** ![madde](https://forum.fairphone.com/user_avatar/forum.fairphone.com/madde/32/86_2.png) [@madde](https://forum.fairphone.com/u/madde)\
**Post date:** [September 25, 2014, 3:10pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/13 "2014-09-25T15:10:25Z")

</div>

hmm… no /usr/bin/env on your phone as well?

Sounds like good news for FP owners by my limited knowledge…

---

<div class="post-metadata">

**Author:** ![kgha](https://forum.fairphone.com/letter_avatar/kgha/32/6_449c533f586939b6e5f246632a46421f.png) [@kgha](https://forum.fairphone.com/u/kgha)\
**Post date:** [September 25, 2014, 3:18pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/14 "2014-09-25T15:18:32Z")

</div>

> [@madde](#):
>
> hmm… no /usr/bin/env on your phone as well?

not even a /usr/bin folder… and /system/bin does not contain any /env file…

---

<div class="post-metadata">

**Author:** ![madde](https://forum.fairphone.com/user_avatar/forum.fairphone.com/madde/32/86_2.png) [@madde](https://forum.fairphone.com/u/madde)\
**Post date:** [September 25, 2014, 3:25pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/15 "2014-09-25T15:25:53Z")

</div>

> [@kgha](#):
>
> not even a /usr/bin folder… and /system/bin does not contain any /env file…

after a bit of research it seems like this is mainly a CM issue and most other Android systems are not affected. Lucky you…

---

<div class="post-metadata">

**Author:** ![kgha](https://forum.fairphone.com/letter_avatar/kgha/32/6_449c533f586939b6e5f246632a46421f.png) [@kgha](https://forum.fairphone.com/u/kgha)\
**Post date:** [September 25, 2014, 6:52pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/16 "2014-09-25T18:52:50Z")

</div>

Yes, it’s a relief, I hope you’ve been able to patch your Fedora install without too much trouble (fixing CM might be more complicated unless a patch will be accessible soon)

---

<div class="post-metadata">

**Author:** ![keesj](https://forum.fairphone.com/user_avatar/forum.fairphone.com/keesj/32/93_2.png) [@keesj](https://forum.fairphone.com/u/keesj)\
**Post date:** [October 2, 2014, 7:46am UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/17 "2014-10-02T07:46:47Z")

</div>

Hi,

On normal web-servers this bug is quite serious because an external attacker gets the possibility to execute programs that run under the bash shell (e.g. an old CGI script for example). On Android phones very few programs will get input from “outside” and pass that to a shell because there is really no need for it (the Android interfaces are quite decent and the shell on Android is really limited). The attack surface is “non existent”. Also we do not run bash so this specific bug does not affect us. Still the Android command line tools have not received the same “love” as bash in terms of security/research so it probably is safe to assume they have a different set of problems !

---

<div class="post-metadata">

**Author:** ![paulakreuzer](https://forum.fairphone.com/user_avatar/forum.fairphone.com/paulakreuzer/32/35401_2.png) [@paulakreuzer](https://forum.fairphone.com/u/paulakreuzer)\
**Post date:** [April 30, 2017, 2:01pm UTC](https://forum.fairphone.com/t/nix-bash-shell-bug/1691/18 "2017-04-30T14:01:10Z")

</div>


