{"record":{"id":"c0a3fbc1730e79a2","repo":"frohoff/ysoserial","slug":"connect-failed","errorCode":null,"errorMessage":"Connect failed","messagePattern":"Connect failed","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"src/main/java/ysoserial/exploit/JBoss.java","lineNumber":258,"sourceCode":"            System.err.println(\"Connect timeout\");\n            System.exit(-1);\n        }\n\n        ConnectionHandlerFactory chf = ioFuture.getInterruptibly();\n        return chf;\n    }\n\n    private static Channel getChannel ( ConnectionProviderContextImpl context, ConnectionHandler ch, OptionMap options ) throws IOException {\n        Channel c;\n        FutureResult<Channel> chResult = new FutureResult<Channel>(context.getExecutor());\n        ch.open(\"jmx\", chResult, options);\n\n        IoFuture<Channel> cFuture = chResult.getIoFuture();\n        Status s2 = cFuture.await();\n        if ( s2 == Status.FAILED ) {\n            System.err.println(\"Cannot connect\");\n            if ( cFuture.getException() != null ) {\n                throw new IOException(\"Connect failed\", cFuture.getException());\n            }\n        }\n        else if ( s2 != Status.DONE ) {\n            cFuture.cancel();\n            throw new IOException(\"Connect timeout\");\n        }\n\n        c = cFuture.get();\n        return c;\n    }\n\n\n    private static VersionedConnection makeVersionedConnection ( Channel c )\n            throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, MalformedURLException {\n        VersionedConnection vc;\n        Class<?> vcf = Class.forName(\"org.jboss.remotingjmx.VersionedConectionFactory\");\n        Method vcCreate = vcf.getDeclaredMethod(\"createVersionedConnection\", Channel.class, Map.class, JMXServiceURL.class);\n        Reflections.setAccessible(vcCreate);","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/frohoff/ysoserial/blob/218bcffcaaa904a4e392f0c15d9e2874533635a3/src/main/java/ysoserial/exploit/JBoss.java#L240-L276","documentation":"JBoss.getChannel uses XNIO's IoFuture to establish a remote Channel; after awaiting the future, if the status is FAILED it throws IOException(\"Connect failed\", cause) wrapping the underlying connection exception. This signals the remote endpoint refused or otherwise failed the connection attempt.","triggerScenarios":"Awaiting the IoFuture<Channel> returns Status.FAILED and cFuture.getException() is non-null — typically when connecting to a JBoss remoting endpoint whose host/port is unreachable, closed, or rejecting the protocol.","commonSituations":"Wrong target host/port in exploit arguments, JBoss remoting port not open, firewall dropping the connection, or target service down.","solutions":["Verify the target host and remoting port are correct and reachable (telnet/nc)","Check the wrapped cause (cFuture.getException()) for the root reason (refused vs timeout vs handshake)","Confirm the JBoss service is running and the remoting connector is enabled","Check network/firewall rules between attacker and target"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check reachability\ntry (Socket s = new Socket()) { s.connect(new InetSocketAddress(host, port), 3000); }","typeGuard":null,"tryCatchPattern":"try {\n    Channel c = getChannel(...);\n} catch (IOException e) {\n    if (e.getCause() != null) log(\"connect failed: \" + e.getCause());\n    // retry or surface actionable message about host/port\n}","preventionTips":["Validate host/port arguments before connecting","Probe the port with nc/telnet before running the exploit","Inspect the wrapped cause to distinguish refusal vs DNS vs TLS issues"],"tags":["java","network","xnio","connection"],"backgroundTag":"connection-refused","analyzedSha":"218bcffcaaa904a4e392f0c15d9e2874533635a3","analyzedAt":"2026-09-12T01:53:58.488Z","contentChangedAt":"2026-09-12T01:53:58.488Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}