frohoff/ysoserial · error · IOException
Connect failed
Error message
Connect failed
What it means
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.
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
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check reachability
try (Socket s = new Socket()) { s.connect(new InetSocketAddress(host, port), 3000); } Try / catch
try {
Channel c = getChannel(...);
} catch (IOException e) {
if (e.getCause() != null) log("connect failed: " + e.getCause());
// retry or surface actionable message about host/port
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Wrong target host/port in exploit arguments, JBoss remoting port not open, firewall dropping the connection, or target service down.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
AI-assisted analysis of frohoff/ysoserial@218bcffcaa (2026-09-12).
Data as JSON: /api/errors/c0a3fbc1730e79a2.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/ysoserial/exploit/JBoss.java:258
System.err.println("Connect timeout");
System.exit(-1);
}
ConnectionHandlerFactory chf = ioFuture.getInterruptibly();
return chf;
}
private static Channel getChannel ( ConnectionProviderContextImpl context, ConnectionHandler ch, OptionMap options ) throws IOException {
Channel c;
FutureResult<Channel> chResult = new FutureResult<Channel>(context.getExecutor());
ch.open("jmx", chResult, options);
IoFuture<Channel> cFuture = chResult.getIoFuture();
Status s2 = cFuture.await();
if ( s2 == Status.FAILED ) {
System.err.println("Cannot connect");
if ( cFuture.getException() != null ) {
throw new IOException("Connect failed", cFuture.getException());
}
}
else if ( s2 != Status.DONE ) {
cFuture.cancel();
throw new IOException("Connect timeout");
}
c = cFuture.get();
return c;
}
private static VersionedConnection makeVersionedConnection ( Channel c )
throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, MalformedURLException {
VersionedConnection vc;
Class<?> vcf = Class.forName("org.jboss.remotingjmx.VersionedConectionFactory");
Method vcCreate = vcf.getDeclaredMethod("createVersionedConnection", Channel.class, Map.class, JMXServiceURL.class);
Reflections.setAccessible(vcCreate);View on GitHub (pinned to 218bcffcaa)