frohoff/ysoserial · error · Exception

Failed to get object id

Error message

Failed to get object id

What it means

JenkinsListener.parseObjIdAndExploit parses the objID out of an exception message expected to contain 'objID:[' (as produced by a failed JRMP round trip). If the message does not contain that marker (start < 0), it throws Exception("Failed to get object id").

Solutions

  1. Verify the target is reachable and the JRMP round trip actually happens (fix connection errors first)
  2. Check the actual exception message text; adjust the parsing marker if the format differs in your Java version
  3. Print e.getMessage() before parsing to debug what the server returned
  4. Ensure you are catching the specific exception that carries the objID, not an earlier failure
Defensive patterns

Strategy: try-catch

Validate before calling

if (e.getMessage() == null || !e.getMessage().contains("objID:[")) {
    throw new IllegalStateException("upstream message lacks objID marker: " + e.getMessage());
}

Try / catch

try {
    parseObjIdAndExploit(args, payloadClass, jrmpPort, isa, e);
} catch (Exception ex) {
    if (ex.getMessage().equals("Failed to get object id")) {
        // log the original message; fix connectivity or version mismatch first
    }
}

Prevention

When it happens

Trigger: The upstream exception's getMessage() lacks the substring 'objID:[' — e.g. the connection failed before the server echoed the ObjID, the error message format changed across Java/Jenkins versions, or a different exception type was passed in.

Common situations: Target Jenkins/Java version whose RMI exception message format differs (Java changed UID/ObjID toString formats across versions); connection refused so no objID is ever echoed; catching a different exception than the expected MarshalException.

Related errors


AI-assisted analysis of frohoff/ysoserial@218bcffcaa (2026-09-12). Data as JSON: /api/errors/8cdbdf12adc8e1aa. Report an issue: GitHub.

Appendix: source

Thrown at src/main/java/ysoserial/exploit/JenkinsListener.java:133


    private static Object makeIsPresentOnRemoteCallable ( int oid, Object uro, Class<?> reqClass )
            throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, ClassNotFoundException {
        Constructor<?> reqCons = reqClass.getDeclaredConstructor(int.class, Method.class, Object[].class);
        Reflections.setAccessible(reqCons);
        return reqCons
                .newInstance(oid, JarLoader.class.getMethod("isPresentOnRemote", Class.forName("hudson.remoting.Checksum")), new Object[] {
                    uro,
        });
    }


    private static void parseObjIdAndExploit ( final String[] args, final Class<? extends ObjectPayload> payloadClass, int jrmpPort,
            InetSocketAddress isa, Exception e ) throws Exception, IOException {
        String msg = e.getMessage();
        int start = msg.indexOf("objID:[");
        if ( start < 0 ) {
            throw new Exception("Failed to get object id");
        }

        int sep = msg.indexOf(", ", start + 1);

        if ( sep < 0 ) {
            throw new Exception("Failed to get object id, separator");
        }

        int end = msg.indexOf("]", sep + 1);

        if ( end < 0 ) {
            throw new Exception("Failed to get object id, separator");
        }

        String uid = msg.substring(start + 7, sep);
        String objNum = msg.substring(sep + 2, end);

        System.err.println("* UID is " + uid);

View on GitHub (pinned to 218bcffcaa)