🚨 CMMC Phase One started November 10! Here's everything you need to know →

How to Secure APIs and WebSockets to Ensure Communication Authenticity in Production - NIST SP 800-171 REV.2 / CMMC 2.0 Level 2 - Control - SC.L2-3.13.15

Practical guide to securing APIs and WebSockets for communication authenticity to meet NIST SP 800-171 Rev.2 / CMMC 2.0 Level 2 SC.L2-3.13.15 compliance.

•
April 23, 2026
•
5 min read

Share:

Schedule Your Free Compliance Consultation

Feeling overwhelmed by compliance requirements? Not sure where to start? Get expert guidance tailored to your specific needs in just 15 minutes.

Personalized Compliance Roadmap
Expert Answers to Your Questions
No Obligation, 100% Free

Limited spots available!

This post explains how to implement communications authenticity controls for APIs and WebSockets to satisfy NIST SP 800-171 Rev.2 / CMMC 2.0 Level 2 control SC.L2-3.13.15, with practical steps, small-business scenarios, concrete technical examples, and compliance tips you can apply in production today.

Understanding the Requirement (SC.L2-3.13.15)

Control SC.L2-3.13.15 requires that organizations ensure the authenticity of communications between components—i.e., that endpoints are who they claim to be and messages haven't been spoofed or replayed. For APIs and WebSockets this maps to authenticated end-to-end transport, verified identities for machines and users, and protections against interception and impersonation (MITM, session hijacking, replay). The control is a Practice in the Compliance Framework and focuses on technical measures (TLS, mutual authentication, token validation) plus supporting processes (key management, logging, change control).

Practical implementation steps for APIs and WebSockets

Start with strong transport security: terminate all API and WebSocket traffic over TLS (HTTPS / WSS), enforce TLS 1.2 minimum and prefer TLS 1.3; disable SSL/TLSv1 and weak ciphers (RC4, export ciphers, 3DES). Use HSTS for browsers and require SNI verification for multi-tenant hosts. For WebSockets ensure the initial handshake is over HTTPS and the endpoint upgrades to WSS—if you're proxying via Nginx or an API gateway, enable proxy_ssl_protocols and proxy_ssl_ciphers for the upstream side as well.

Implement endpoint authentication: for user-facing APIs use OAuth2/OpenID Connect with short-lived access tokens (JWTs signed with RS256 or ES256) and validate issuer (iss), audience (aud), expiry (exp), and token revocation/rotation. For machine-to-machine or service-to-service calls, use mutual TLS (mTLS) where clients present certificates validated against your CA/trust store—mTLS is the strongest way to ensure both parties are authentic. Keep a certificate lifecycle policy (issuing/rotation/revocation) and automate renewal with ACME or your PKI.

Design for token security and replay protection: sign tokens, include jti (JWT ID) and nonce where relevant, and reject tokens outside their lifetime. For WebSockets, perform an authenticated HTTP-based handshake (e.g., include a short-lived token in the Upgrade request or require mTLS at handshake time) and then bind the WebSocket session to the initial authentication context (session ID or token) so reconnections require re-authentication. Consider using channel binding (if available) to tie higher-layer auth to TLS session parameters.

API gateway, proxies, and WAF considerations

Place an API gateway or reverse proxy (AWS API Gateway, Kong, Nginx, Traefik) in front of services to centralize TLS config, authentication, rate limiting, and logging. Configure the gateway to validate JWTs via your JWKS endpoint (cache keys but respect cache-control/rotation), enforce scope and role checks, and apply per-client rate limits to reduce abuse. For WebSocket traffic use a gateway that properly forwards Upgrade headers and preserves client certificate attributes if using mTLS; ensure health checks and timeouts are tuned to avoid prematurely closing long-lived sockets.

Example Nginx proxy snippet for WSS with TLS (adapt certificate paths and ciphers to your environment):

server {
    listen 443 ssl;
    server_name api.example.com;
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:...';
    ssl_certificate /etc/ssl/certs/example.crt;
    ssl_certificate_key /etc/ssl/private/example.key;
    add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";

    location /ws/ {
        proxy_pass http://backend-ws;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
        proxy_read_timeout 3600s;
    }
}

Small-business real-world scenarios

Scenario A: A small SaaS business exposes REST APIs to customers and has a real-time notifications feature using WebSockets. Implementation steps: terminate TLS at a managed load balancer (e.g., AWS ALB), require API clients to authenticate with OAuth2, validate access tokens at the gateway, and use short token lifetimes (5-15 minutes) for WebSocket handshakes—re-authenticate on reconnect. If customers prefer mutual auth for B2B integrations, offer mTLS client certificates and maintain a customer certificate registry.

Scenario B: An IoT startup streams telemetry via WebSockets to a cloud collector. Use device identity: provision each device with a unique certificate or an asymmetric keypair; connect over WSS with mTLS to ensure devices are genuine. Implement telemetry topic authorization (don’t let a device write to another device’s stream), and log both successful and failed handshakes to detect impersonation attempts. Automate certificate revocation when devices are decommissioned or compromised.

Logging, monitoring, and the risk of non-compliance

Log authentication events (successful/failed TLS handshakes, JWT validation failures, token expirations, revocations) with sufficient context: timestamp, client IP, client certificate subject, JWT jti, correlation ID, endpoint accessed. Feed these logs to a central SIEM or log aggregation (CloudWatch, ELK, Splunk) and create alerts for repeated handshake failures, sudden spikes in token errors, or unusual WebSocket reconnection patterns. Without these controls you risk MITM, session hijacking, unauthorized access to CUI (controlled unclassified information), contract violations, potential breaches, and failing NIST/CMMC audits—leading to remediation costs and lost business.

Compliance tips and best practices

Maintain an inventory of endpoints and map which ones require mTLS vs. token-based auth; create documented procedures for certificate/key issuance, rotation (e.g., rotate keys every 90 days for keys used in signing, certificates according to your risk profile), and revocation; enforce least privilege in token scopes; conduct periodic penetration tests and TLS configuration scans (sslscan, testssl.sh, or SSL Labs); include communications authenticity in your change control and configuration management records; and make authentication test cases part of your CI/CD pipeline so regressions are detected early.

Summary: To meet SC.L2-3.13.15, enforce strong transport security (TLS/WSS), authenticate both ends (JWT/OAuth2 for users, mTLS for machines), centralize validation at an API gateway, automate key and certificate lifecycle, and monitor authentication events. These steps reduce impersonation and replay risks and provide the audit trails auditors require—critical for small businesses that must protect CUI and demonstrate compliance with NIST SP 800-171 Rev.2 / CMMC 2.0 Level 2.

 

Quick & Simple

Discover Our Cybersecurity Compliance Solutions:

Whether you need to meet and maintain your compliance requirements, help your clients meet them, or verify supplier compliance we have the expertise and solution for you

 CMMC Level 1 Compliance App

CMMC Level 1 Compliance

Become compliant, provide compliance services, or verify partner compliance with CMMC Level 1 Basic Safeguarding of Covered Contractor Information Systems requirements.
 NIST SP 800-171 & CMMC Level 2 Compliance App

NIST SP 800-171 & CMMC Level 2 Compliance

Become compliant, provide compliance services, or verify partner compliance with NIST SP 800-171 and CMMC Level 2 requirements.
 HIPAA Compliance App

HIPAA Compliance

Become compliant, provide compliance services, or verify partner compliance with HIPAA security rule requirements.
 ISO 27001 Compliance App

ISO 27001 Compliance

Become compliant, provide compliance services, or verify partner compliance with ISO 27001 requirements.
 FAR 52.204-21 Compliance App

FAR 52.204-21 Compliance

Become compliant, provide compliance services, or verify partner compliance with FAR 52.204-21 Basic Safeguarding of Covered Contractor Information Systems requirements.
 
Hello! How can we help today? 😃

Chat with Lakeridge

We typically reply within minutes