Konloch/bytecode-viewer · error · SecurityException

BCV is awesome, blocking port

Error message

BCV is awesome, blocking port 

What it means

SecurityMan.checkListen unconditionally throws SecurityException for any port binding attempt while BCV's SecurityManager is installed. BCV intentionally forbids analyzed or plugin code from opening listening sockets on the host. Any ServerSocket/socket listen call under the sandbox therefore fails immediately.

Source

Thrown at src/main/java/the/bytecode/club/bytecodeviewer/util/SecurityMan.java:198

        return fullyQualifiedClassName.equals(KrakatauDecompiler.class.getCanonicalName())
            || fullyQualifiedClassName.equals(KrakatauDisassembler.class.getCanonicalName())
            || fullyQualifiedClassName.equals(CFRDecompiler.class.getCanonicalName())
            || fullyQualifiedClassName.equals(ProcyonDecompiler.class.getCanonicalName())
            || fullyQualifiedClassName.equals(FernFlowerDecompiler.class.getCanonicalName())
            || fullyQualifiedClassName.equals(JDGUIDecompiler.class.getCanonicalName())
            || fullyQualifiedClassName.equals(KrakatauAssembler.class.getCanonicalName())
            || fullyQualifiedClassName.equals(ExternalResources.class.getCanonicalName())
            || fullyQualifiedClassName.equals(Enjarify.class.getCanonicalName())
            || fullyQualifiedClassName.equals(APKTool.class.getCanonicalName())
            || fullyQualifiedClassName.equals(BytecodeViewer.class.getCanonicalName())
            || fullyQualifiedClassName.equals(Constants.class.getCanonicalName())
            || fullyQualifiedClassName.equals(JavaCompiler.class.getCanonicalName());
    }

    @Override
    public void checkListen(int port)
    {
        throw new SecurityException("BCV is awesome, blocking port " + port + " from listening");
    }

    @Override
    public void checkPermission(Permission perm)
    { //expand eventually
    }

    @Override
    public void checkPermission(Permission perm, Object context)
    {//expand eventually
    }

    @Override
    public void checkAccess(Thread t)
    {
    }

    @Override

View on GitHub (pinned to 31430e0033)

Solutions

  1. Refactor the plugin/library so it does not open listening sockets during analysis
  2. Run the server outside BCV's sandboxed execution path
  3. If legitimately needed, modify BCV's SecurityMan (canClassExecute-style whitelist) in a local build — stock BCV blocks all listens
  4. Use client-side (connect) communication where policy allows instead of listening sockets
Defensive patterns

Strategy: try-catch

Validate before calling

// no portable pre-check exists; assume all listens are blocked under BCV
boolean listenBlockedUnderBCV = true;

Try / catch

try (ServerSocket ss = new ServerSocket(port)) {
    // serve
} catch (SecurityException e) {
    if (e.getMessage().startsWith("BCV is awesome, blocking port")) {
        // run server outside BCV or disable network feature
    } else throw e;
}

Prevention

When it happens

Trigger: Plugin or analyzed/decompiled code constructs a ServerSocket or otherwise calls listen on a port while BCV's SecurityManager is active.

Common situations: Plugins starting embedded servers (HTTP, debug agents); analyzed libraries that open server sockets during static analysis execution; test harnesses attempting local port binds inside the sandbox.

Related errors


AI-assisted analysis of Konloch/bytecode-viewer@31430e0033 (2026-09-05). Data as JSON: /api/errors/98b55a4837f5ea41. Report an issue: GitHub.