Skip to content

Instantly share code, notes, and snippets.

@umrysh
Created September 25, 2014 19:53
Show Gist options
  • Select an option

  • Save umrysh/796d525327f2b1c12abe to your computer and use it in GitHub Desktop.

Select an option

Save umrysh/796d525327f2b1c12abe to your computer and use it in GitHub Desktop.

Revisions

  1. umrysh created this gist Sep 25, 2014.
    26 changes: 26 additions & 0 deletions compile_bash.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/bin/bash
    #
    # Put this in /usr/local/src/, make it executable and run it.
    # Script From [https://dmsimard.com/2014/09/25/the-bash-cve-2014-6271-shellshock-vulnerability/]
    #
    # dependencies
    apt-get update; apt-get install build-essential gettext bison

    # get bash 3.2 source
    wget http://ftp.gnu.org/gnu/bash/bash-3.2.tar.gz
    tar zxvf bash-3.2.tar.gz
    cd bash-3.2

    # download and apply all patches, including the latest one that patches CVE-2014-6271
    for i in $(seq -f "%03g" 1 52); do
    wget -nv http://ftp.gnu.org/gnu/bash/bash-3.2-patches/bash32-$i
    patch -p0 < bash32-$i
    done

    # compile and install to /usr/local/bin/bash
    ./configure && make
    make install

    # point /bin/bash to the new binary
    mv /bin/bash /bin/bash.old
    ln -s /usr/local/bin/bash /bin/bash