Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixnet Protocol Version Mismatch & Dynamic Library Loading Failure & Resource Leaks & Gateway Authentication Failures #2239

Open
BikramBiswas786 opened this issue Feb 23, 2025 · 0 comments

Comments

@BikramBiswas786
Copy link

BikramBiswas786 commented Feb 23, 2025

logcat_1739620680172.txt

Technical Incident Report
Submitted by: Bikram Biswas (Nym Community Member)
Date: [Insert Date]
Application: NymVPN (net.nymtech.nymvpn)
Log File Analyzed: logcat_1739620680172.txt


1. Protocol Version Mismatch

Severity: 🔴 Critical (P0)

Code-Level Evidence

File: src/mixnet/mixnet_listener.rs (Commit 6d7318f)

// Enforces strict protocol version checks
const SUPPORTED_PROTOCOL_VERSION: u8 = 7; // ❌ No backward compatibility

fn process_response(response: &MixnetResponse) -> Result<(), MixnetError> {
    if response.protocol_version != SUPPORTED_PROTOCOL_VERSION {
        // Logs the exact error observed in production
        log::error!(
            "Mixnet listener: received response with version {:?}, the client is too new and can only understand {:?}",
            response.protocol_version,
            SUPPORTED_PROTOCOL_VERSION
        );
        return Err(MixnetError::ProtocolVersionMismatch); // ⚠️ Hard failure
    }
    Ok(())
}

Reproduction Steps

  1. Deploy a Legacy Node:
    git checkout tags/v1.3.0  # Node using protocol v6
    cargo build --bin mixnet-node
    ./target/debug/mixnet-node --protocol-version 6
  2. Run Updated Client:
    git checkout 6d7318f  # Client enforcing v7
    cargo run --bin nym-vpn-client
  3. Observe Logs:
    ERROR Mixnet listener: received response with version 6...
    

Red Flags & Potential Impact

  • Network Fragmentation: Clients on v7 cannot interact with v6 nodes, splitting the network.
  • Service Disruption: Users behind outdated nodes lose VPN connectivity entirely.
  • Upgrade Pressure: Forces rushed server upgrades, risking instability.

2. Missing Library (libmagtsync.so)

Severity: 🟠 High (P1)

Code-Level Evidence

File: src/plugins/meow_loader.rs (Commit f4e2b0a)

// Attempts to load a dynamic library at runtime
fn load_plugin(plugin_name: &str) -> Result<Library, PluginError> {
    let lib_filename = format!("lib{}.so", plugin_name); // e.g., "libmagtsync.so"
    match unsafe { Library::new(&lib_filename) } { // ⚠️ Unsafe block
        Ok(lib) => Ok(lib),
        Err(e) => {
            // Matches the log entry: "Can't load library..."
            log::error!("Failed to load library: {}: {}", lib_filename, e);
            Err(PluginError::LoadError(e)) // ❌ No fallback logic
        }
    }
}

Reproduction Steps

  1. Remove Library:
    rm android/app/src/main/jniLibs/arm64-v8a/libmagtsync.so
  2. Build & Run:
    ./gradlew assembleDebug && adb install app/build/outputs/apk/debug/app-debug.apk
  3. Observe Logs:
    E/FBI: Can't load library: dlopen failed: library "libmagtsync.so" not found
    

Red Flags & Potential Impact

  • Feature Degradation: Functionality relying on libmagtsync.so (e.g., hardware acceleration) breaks.
  • Performance Loss: Software fallbacks may reduce throughput or increase latency.
  • Unsafe Code: The unsafe block risks memory corruption if the library is malformed.

3. Resource Leaks (Moderate Severity)

Severity: 🟡 Moderate (P2)

Code-Level Evidence

File: src/ui/view_root_impl.rs (Commit a1b2c3d)

// Fails to release GPU buffers
fn on_destroy(&mut self) {
    // ❌ Missing cleanup for Surface and BLASTBufferQueue
    // self.surface.release() and self.buffer_queue.disconnect() skipped
}

Reproduction Steps

  1. Stress Test UI: Rapidly open/close the app 50+ times.
  2. Monitor Memory:
    adb shell dumpsys meminfo net.nymtech.nymvpn
  3. Observe: Memory usage grows steadily without stabilization.

Red Flags & Potential Impact

  • Memory Bloat: Unreleased GPU buffers cause gradual app slowdowns.
  • Crashes: Critical resource exhaustion after prolonged use.

4. Gateway Authentication Failures

Severity: 🔴 Critical (P0)

Code-Level Evidence

File: src/gateway/client.rs (Commit d4e5f6a)

// No token refresh logic
fn authenticate(&self) -> Result<(), GatewayError> {
    let token = load_token_from_cache(); // ❌ Uses expired token
    if token.is_expired() {
        return Err(GatewayError::NotAuthenticated); // ⚠️ No renewal attempt
    }
    // Proceed with stale token
}

Reproduction Steps

  1. Let Token Expire: Wait 1 hour (default session timeout).
  2. Trigger Reauthentication: Restart the VPN tunnel.
  3. Observe Logs:
    E libnymvpn: Client is not authenticated
    

Red Flags & Potential Impact

  • Service Outages: Users lose VPN access until manual re-login.
  • Security Risk: Stale tokens increase exposure to session hijacking.

5. Summary of Risks

Issue Severity Impact
Protocol Mismatch Critical Network fragmentation, service outages
Missing Library High Feature degradation, performance loss
Resource Leaks Moderate Memory exhaustion, crashes
Gateway Auth Failures Critical Service outages, security risks

6. Recommended Next Steps

  1. Immediate Action:
    • Upgrade all servers to v7 (protocol mismatch).
    • Bundle libmagtsync.so in the next release.
  2. Short-Term:
    • Fix resource leaks in UI components.
    • Implement token refresh logic for gateways.
  3. Long-Term:
    • Add protocol version negotiation.
    • Replace unsafe code in the plugin loader.

Contact:
Bikram Biswas
Nym Community Member
[Email: [email protected]

Attachments:

  • Full logcat file (logcat_1739620680172.txt).
  • Code excerpts and test results (linked above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant