This project is a proof-of-concept client-server application designed to improve resistance to interception by dynamically switching network endpoints—similar to Frequency Hopping Spread Spectrum (FHSS). It features:
- Endpoint Hopping: Switching between a predefined list of endpoints at fixed time intervals.
- Pseudorandom Endpoint Selection: Both client and server derive the active endpoint using an HMAC-SHA256 algorithm with a shared secret.
- Dynamic Listener Switching: The server binds only to the active endpoint for each time slot and re-binds when the slot expires.
- Clock Synchronization: A basic SYNC handshake (with an option for robust, multi-round sync) to align the clocks of the client and server.
- TLS Encryption with Connection Timeouts: All communications are secured with TLS. The client uses
tls.DialWithDialerto enforce connection timeouts. - Optional Challenge–Response Authentication: Adds an extra layer of authentication using a unique challenge nonce for every new connection. If an endpoint switch occurs during the handshake, the connection aborts and a new challenge is generated on the next attempt.
- Optional Timestamped Messages: Ensures message freshness by including a timestamp with each message, which the server verifies to prevent replay attacks.
-
Endpoint Hopping:
Uses a list of endpoints (e.g.,127.0.0.1:8001to127.0.0.1:8010) and changes the active endpoint every fixed time slot (default: 10 seconds). -
Pseudorandom Endpoint Selection:
The active endpoint for each time slot is computed by hashing the time slot (derived from the current time) using HMAC-SHA256 with a shared secret. Only entities possessing the secret can predict the hopping sequence. -
Dynamic Listener Switching:
The server binds exclusively to the active endpoint for the duration of a time slot, then re-binds as the slot changes—making interception more challenging. -
Clock Synchronization:
The client aligns its clock with the server using a SYNC handshake over TLS. Optionally, multiple synchronization rounds can be performed to average out network latency. -
TLS Connection Timeout:
The client leveragestls.DialWithDialerwith a configurable timeout (for example, 5 seconds) to ensure that slow connections (potentially caused by endpoint switching) are aborted and retried. -
Optional Challenge–Response Authentication:
When enabled, the server generates a new random nonce for each new TLS connection and sends it as part of a challenge. The client must respond with a correct HMAC value (using the shared secret) before the connection proceeds. If an endpoint switch occurs during the handshake, the connection is aborted, and a new challenge will be issued upon reconnecting. -
Optional Timestamped Messages:
If enabled, messages are prefixed with a timestamp. The server checks that the message timestamp is within an acceptable window to mitigate replay attacks.
This software is provided for educational and research only.
It is not intended to facilitate or hide:
- Malware command-and-control infrastructure
- Unauthorized access or intrusion attempts
- Fraud, impersonation, or harassment
- Evading lawful monitoring, surveillance, or regulation
- Use it only in compliance with applicable laws in your jurisdiction
- Take full responsibility for your actions
- Respect the privacy and security of others
Reminder: Just because something can evade detection doesn’t mean it should. This project aims to empower resilience, not recklessness.
If you’re unsure whether your use case is acceptable, err on the side of caution and seek legal advice
Generate a self-signed certificate and private key using OpenSSL:
openssl req -x509 -newkey rsa:4096 -nodes -keyout server.key -out server.crt -days 365 -subj "/CN=localhost"This command creates server.crt and server.key, which the server uses for its TLS configuration.
Clone the repository and change to the project directory:
git clone https://github.com/tomoconnor/gofhss.git
cd gofhssTo start the server (for example, with challenge–response and timestamp verification enabled):
go run main.go -mode=server -challenge=true -timestamp=trueThe server will:
- Compute the active endpoint for the current time slot using the shared secret.
- Securely bind to that endpoint via TLS.
- Switch endpoints when the time slot expires. Each new connection (including those after an endpoint switch) triggers a new challenge handshake.
To run the client with all features enabled (robust clock sync, timestamped messages, challenge–response authentication, and TLS connection timeout), use:
go run main.go -mode=client -msg="Hello, world!" -robust=true -timestamp=true -challenge=trueThe client will:
- Synchronize its clock with the server (using either a single SYNC handshake or multiple rounds if robust sync is enabled).
- Use
tls.DialWithDialerwith a specified timeout (e.g., 5 seconds) to connect securely. - Perform a challenge–response handshake. If the active endpoint changes during the handshake, the connection is aborted and retried, ensuring each connection gets a fresh challenge.
- Prepend a timestamp to the message (if enabled) and send it to the server.
- Receive and display the server’s echo response.
-
Pseudorandom Endpoint Selection:
Both client and server use an HMAC-SHA256 algorithm with the shared secret and the current time slot to determine the active endpoint. -
Dynamic Listener Switching:
The server binds to the active endpoint for a given time slot and switches as the slot expires, complicating any interception attempts. -
Clock Synchronization:
The client aligns its clock with the server using a SYNC handshake. Optionally, multiple rounds of synchronization average out network delays. -
TLS Connection Timeout:
The client usestls.DialWithDialerwith a timeout to prevent prolonged connection attempts if the endpoint becomes outdated due to switching. -
Optional Challenge–Response:
Every new connection results in the server generating a fresh nonce for a challenge. The client must respond with the correct HMAC response based on this nonce and the shared secret. If the endpoint changes during the handshake, the connection aborts and a new challenge is generated on the next attempt. -
Optional Timestamped Messages:
The client prepends a timestamp to each message, and the server verifies that the message is recent to prevent replay attacks.
-
Proof-of-Concept:
This project is a proof-of-concept. Additional hardening is required for production environments. -
Shared Secret:
The integrity of the pseudorandom endpoint selection and challenge–response mechanisms depends on safeguarding the shared secret. -
Clock Synchronization:
Consider more robust synchronization methods (e.g., NTP-like algorithms) in scenarios with high latency or significant clock drift. -
TLS Certificate Validation:
In production, proper certificate validation should be enforced rather than usingInsecureSkipVerify. -
Timeout Tuning:
Adjust the TLS connection timeout based on your network conditions to achieve a balance between responsiveness and reliability.
- Enhance clock synchronization using statistically robust filtering.
- Improve error handling and logging mechanisms.
- Integrate proper certificate validation on the client.
- Allow dynamic configuration of time slot duration and connection timeout.
- Explore secret rotation strategies and more sophisticated pseudorandom algorithms.
This project is licensed under the GNU Affero General Public License, version 3 (AGPLv3). You can find a copy of the license in the LICENSE file or view it online at https://www.gnu.org/licenses/agpl-3.0.html.