SAF-LEP is a Proof-of-Concept VPN tunneling tool designed to evade Deep Packet Inspection (DPI) by masquerading encrypted traffic as low-entropy "noise" or potentially mimicking unencrypted media streams (future work).
The core idea is Low Entropy Protocol (LEP): instead of sending a solid block of high-entropy encrypted data (which is easily flagged by DPI as "unknown encrypted protocol" or WireGuard/OpenVPN), LEP embeds the encrypted payload into a larger, lower-entropy frame, or distributes it in a way that statistically resembles natural data.
This is a Proof-of-Concept project for research and educational purposes only.
DO NOT use this for protecting sensitive data. The cryptographic implementation is intentionally simplified for demonstration purposes and has known weaknesses:
- Custom stream cipher based on xorshift - not cryptographically secure
- Key derivation uses DJB2 hash instead of proper KDFs (PBKDF2, Argon2)
- Non-cryptographic PRNG (LCG) for ground state generation
The goal of this project is DPI evasion, not secure encryption. If you need actual security, use established VPNs (WireGuard, OpenVPN) or layer this tool with proper encryption.
- Cross-Platform: Runs on Windows (using TAP-Windows adapter) and Linux (using TUN interface). Android support is in progress.
- P2P Architecture: UDP-based tunneling with NAT traversal capabilities.
- Fragmentation & Reassembly: Custom reliability layer over UDP to handle large IP packets (MTU 1500) over smaller UDP datagrams.
- Resiliency: Implements packet loss detection and retransmission (ARQ) with backoff logic to prevent network flooding.
- Live Watchscreen: Real-time monitoring of VPN statistics, throughput, and packet events with
-wflag. - DPI Evasion:
- Low Entropy Encoding: Payload is encoded to reduce statistical randomness.
- Jitter/Padding: (Planned) Traffic shaping to hide packet timing signatures.
- Windows (TAP-Windows adapter)
- Linux (TUN interface)
- Android (VpnService API) - JNI bridge and core C++ integration complete, but full app not yet finalized. See
android/directory for bare-bones implementation.
- Android Server Mode - Allow Android devices to act as VPN exit nodes
- iOS Support - Using NetworkExtension framework
- macOS Support - Using utun interface
- Complete Android VPN Client - Finish the Android app with proper UI and integration
- High priority β
- Fully automatic setup (just address and mode flag, nothing more π )
- Containerized version (Docker)
- More encoding "modes" (currently only
raw_lep_v0is implemented - partially VoIP/MPEG1 like headers with near-constant value fields)htmlraw_textrtsp- ... whatever π
- Improved NAT traversal (STUN/TURN integration)
- CMake (3.10+)
- Boost Libraries (System, Thread, Asio)
- C++23 Compliant Compiler (MSVC for Windows, GCC/Clang for Linux)
mkdir build_linux
cd build_linux
cmake ..
make- Open the folder in Visual Studio (or use CMake GUI).
- Ensure
Boost_ROOTis set if not in standard paths. - Build the
SAF-LEP.exetarget.
Open SAF-LEP-ExPuN.sln in Visual Studio. Requires static Boost libraries installed via vcpkg:
# Install vcpkg globally if not already installed
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg integrate install
# Install Boost
.\vcpkg install boost:x64-windows-staticNote: Android support is currently in development.
For developers interested in contributing or testing, see the Android README for the current state and build instructions.
Usage: SAF-LEP [OPTIONS]
Options:
-p, --port PORT Local UDP port (default: 0 = auto)
-c, --connect HOST:PORT Connect to peer
-v, --verbose Enable verbose logging
-w, --watchscreen Enable live stats watchscreen
--ip IP VPN IP address (e.g. 10.0.0.1)
--mask MASK VPN Subnet mask (default: 255.255.255.0)
--gw GATEWAY VPN Gateway (optional)
-k, --seed-key KEY Encryption seed key (optional)
-h, --help Show help message
The server acts as the exit node. It needs to forward traffic from the VPN interface (tun0) to the internet (eth0 or wlan0).
Enable IP Forwarding & NAT:
# 1. Enable IP Forwarding
sudo sysctl -w net.ipv4.ip_forward=1
# 2. Enable NAT (Masquerade) for outgoing traffic
# Replace 'eth0' with your internet interface name (check with `ip addr`)
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# 3. Allow Forwarding
sudo iptables -A FORWARD -i tun0 -o eth0 -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT
# 4. Enable MSS Clamping (Critical for some sites to load)
sudo iptables -t mangle -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtuRun Server:
sudo ./SAF-LEP -p 14578 --ip 10.0.0.1# 1. Add route to server public IP via local gateway
# Example: Server=1.2.3.4, LocalGateway=192.168.1.1
sudo ip route add 1.2.3.4 via 192.168.1.1
# 2. Run Client
sudo ./SAF-LEP -c 1.2.3.4:14578 --ip 10.0.0.2 --gw 10.0.0.1netsh commands may not handle encoding properly.
To rename your TAP adapter:
- Open Control Panel β Network and Sharing Center β Change adapter settings
- Find your TAP adapter (usually named "Ethernet 2" or "TAP-Windows Adapter V9")
- Right-click β Rename β Use only English letters, numbers, spaces, and basic punctuation
- Examples of GOOD names:
VPN-TAP,SAF_LEP_Adapter,TAP Adapter 1 - Examples of BAD names:
VPNιι ε¨,ΠΠ΄Π°ΠΏΡΠ΅Ρ,VPNβ‘Adapter
Setup Commands:
# 1. Add route to server public IP via local gateway
# Open Admin PowerShell/CMD
# Example: Server=1.2.3.4, LocalGateway=192.168.1.1
route add 1.2.3.4 mask 255.255.255.255 192.168.1.1 metric 1
# 2. Run Client
./SAF-LEP.exe -c 1.2.3.4:14578 --ip 10.0.0.2 --gw 10.0.0.1From the Client:
# Ping the server's VPN IP
ping 10.0.0.1
# Check internet connectivity (should hop through 10.0.0.1)
tracert 8.8.8.8 # Windows
traceroute 8.8.8.8 # Linux- Ensure both Client and Server are running the latest version.
- Check firewall on Server (allow UDP port 14578).
- Check Windows Firewall on Client (allow
SAF-LEP.exe).
- This usually means the TAP adapter is not configured correctly or the route is missing.
- The application now attempts to force the route to the TAP interface index. Check logs for
Using Interface Index: X.
- Check adapter name encoding: Ensure your TAP adapter has an ASCII-only name (see Windows Client Setup section above).
- Symptoms: Application starts but IP configuration fails, or
netshcommands fail silently. - Solution: Rename your TAP adapter to contain only English letters, numbers, and basic punctuation.
- This is normal for TAP adapters without a default gateway. It does not affect functionality as long as the routes are correct.
- Weak Cryptography: Intentionally simplified; see Security Notice above
- No Perfect Forward Secrecy: Static keys only
- No Authentication: Peers are not cryptographically authenticated
- Hardcoded MAC Addresses: Uses fixed dummy MAC for ARP responses
PRs for improvements and new encoding modes are welcome!
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Application Layer β
β (Ping, HTTP, etc. on VPN interface) β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β VPN Interface Layer β
β (TAP/TUN adapter - Ethernet/IP packets) β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β Fragmentation/Reassembly Layer β
β (Splits packets into 150-byte chunks) β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β Encryption Layer β
β (XOR-based stream cipher) β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β Low Entropy Protocol (LEP) Encoding β
β (Embeds encrypted data in low-entropy frames) β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β UDP/IP Layer (Boost.ASIO) β
β (Sends encoded packets over UDP) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ