Skip to content

macOS: AmneziaVPN-service crashes with SIGSEGV on connection attempt, leaving network unreachable #2637

@Wooden210

Description

@Wooden210

Environment

  • macOS Sequoia 15.7.7 (24G720)
  • AmneziaVPN 4.8.15.4 (2edd7de)
  • Hardware: MacBook Pro 17,1 (x86_64 via Rosetta 2)
  • Protocol: AmneziaWG (amnezia-awg2 container)

Behavior

When pressing "Connect", AmneziaVPN-service crashes with SIGSEGV, leaving the routing table broken and the entire network unreachable until reboot.

Crash happens multiple times per session (confirmed in DiagnosticReports).

Crash info

Exception: EXC_BAD_ACCESS (SIGSEGV) — KERN_INVALID_ADDRESS at 0x0000000000000008

Faulting stack trace:

DaemonLocalServerConnection::write(QJsonObject const&)
DaemonLocalServerConnection::disconnected()         ← null ptr dereference here
DaemonLocalServerConnection::parseCommand(QByteArray const&)
DaemonLocalServerConnection::readData()
QAbstractSocketPrivate::canReadNotification()
QCoreApplication::sendEvent()
QEventDispatcherUNIX::processEvents()
QEventLoop::exec()
QCoreApplication::exec()
main

Root cause

Race condition: when a new connection attempt is initiated while a previous one is still deactivating, disconnected() is called on a DaemonLocalServerConnection object that has already been freed/nulled, causing a null pointer dereference at offset +8.

Visible in app log:

[17:42:50] LocalSocketController: Deactivating
[17:42:50] VpnProtocol::setConnectionState "Отключено"
[17:42:50] LocalSocketController: Deactivating    ← second call while first still in progress
[17:42:50] VpnProtocol::setConnectionState "Отключено"

Network impact

After crash, routing table contains stale entries:

0/1      utun4   ← all traffic routed to dead VPN interface
128.0/1  utun4

This blocks all internet traffic. KeepAlive=true restarts the daemon, but stale routes remain, requiring full reboot to recover.

Steps to reproduce

  1. Have an AmneziaWG connection configured
  2. Click "Connect"
  3. While connecting, click "Connect" again or let it fail and retry quickly

Expected behavior

Service should not crash; on disconnect/retry it should safely handle already-freed connection objects. On service crash, routes should be cleaned up (e.g. via launchd cleanup handler).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions