Summary
PikiwiDB (Pika) v3.5.7 exposes an internal protobuf replication service that can process sensitive replication requests without requiring authentication. An unauthenticated remote attacker may obtain database snapshots and live write streams or remove replica nodes when the replication port is reachable, even if requirepass is configured.
Affected context
The issue occurs in Pika deployments where the internal replication server is exposed on its derived port, typically the client port plus 2000. Although the replication protocol includes password handling for the MetaSync operation, request dispatch can route other replication message types without first establishing an authenticated session. Risk depends on network exposure and access controls around the replication port.
Exploit preconditions
- Attack surface: Network-accessible internal protobuf replication port
- Required access: Remote network connectivity to the replication service; valid credentials are not required
- Trigger point: Processing of replication requests other than the authenticated MetaSync flow
- Why exploitation is possible: The dispatcher does not require a completed or attempted authenticated synchronization session before routing replication messages to their handlers
Why this happens
The underlying flaw is an authentication enforcement gap in the replication protocol. Authentication is checked in the MetaSync handler, but the common message dispatcher permits other request types to proceed without verifying that the connection has completed an authenticated session. This behavior maps to CWE-306: Missing Authentication for Critical Function, because privileged replication operations are reachable without the required identity verification.
Potential impact
- An attacker may obtain a full database synchronization snapshot
- An attacker could read the live replication write stream
- Replica nodes may be removed or disrupted
- Sensitive database contents may be exposed
- Data integrity and replication availability can be affected
- Downstream systems may receive unauthorized or incomplete replicated data
General mitigation guidance
Mitigation generally focuses on enforcing authentication consistently across the entire replication protocol and reducing exposure of internal services.
Common defensive patterns include:
- Require an authenticated session before dispatching any replication operation
- Apply authorization checks independently to every privileged message type
- Bind replication services to protected network interfaces where possible
- Restrict replication-port access with network segmentation and deny-by-default firewall policy
- Use secure-by-default settings that do not expose internal replication endpoints broadly
- Run database processes with only the privileges required for replication
- Treat replication traffic as sensitive and protect it with appropriate transport and access controls
How teams detect issues like this
Organizations can detect this class of issue through:
- Static analysis and code review checks for authentication performed only in individual handlers rather than at a shared authorization boundary
- Tests that send each privileged protocol message before and after authentication
- Network monitoring for unexpected connections to derived replication ports
- Audit logging for replication requests, snapshot transfers, write-stream access, and replica-removal operations
- Policy enforcement requiring internal database services to be unreachable from untrusted network segments
- Automated security review tools that identify unauthenticated access to sensitive protocol handlers

