CIS Kong Gateway Benchmark

Security configuration benchmark for Kong API Gateway

v1.0.0 03-2025

Overview

▶

This benchmark provides prescriptive guidance for establishing a secure configuration posture for Kong Gateway. It covers Admin API restriction, RBAC enforcement, proxy and upstream TLS, access logging, rate limiting, authentication plugins, IP restriction, CORS policies, request size limiting, database TLS, and configuration hardening.

14Recommendations
7Sections
2Profile Levels
SectionAreaFocus
1Installation & IdentityVersion management, dedicated user
2Admin API SecurityLocalhost binding, RBAC
3TLS ConfigurationProxy TLS, upstream verification
4Logging & MonitoringAccess logs, error log rotation
5Traffic ControlRate limiting, authentication plugins
6Request SecurityIP restriction, CORS, payload limits
7Maintenance & HardeningDatabase TLS, file permissions

Profile Definitions

▶
ProfileDescriptionIntended Use
L1Level 1 — StandardEssential security for all Kong Gateway deployments; minimal performance impact.
L2Level 2 — HardenedAdvanced hardening for PCI-DSS, HIPAA, or high-security environments.

1 — Installation & Identity

▶

1.1 Version & Process Security

▶
1.1.1 Ensure Kong is running the latest stable version (Manual)
L1 Manual
Description

This recommendation verifies that Kong is running the latest stable version on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Verify Kong version
kong version
kong health
Remediation
# Update Kong to latest stable
apt-get update && apt-get install --only-upgrade kong
# Or via Docker:
# docker pull kong:latest
kong migrations up
kong restart
1.1.2 Ensure Kong runs as a dedicated non-root user (Automated)
L1 Auto
Description

This recommendation verifies that Kong runs as a dedicated non-root user on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check Kong runs as dedicated user
ps -eo user,pid,comm | grep kong
grep -E 'nginx_user' /etc/kong/kong.conf
Remediation
# Configure dedicated user
# In kong.conf:
# nginx_user = kong kong
useradd -r -s /usr/sbin/nologin kong
chown -R kong:kong /etc/kong/

2 — Admin API Security

▶

2.1 Binding & RBAC

▶
2.1.1 Ensure Admin API is restricted to localhost with TLS (Automated)
L1 Auto
Description

This setting ensures that Admin API is restricted to localhost with TLS on the Kong Gateway API gateway. Restricting this capability limits potential abuse and enforces the principle of least privilege across the environment.

Rationale

Unrestricted access to this capability could allow unauthorized users or processes to perform actions beyond their intended scope. Applying least-privilege principles to the Kong Gateway API gateway is essential for defense in depth.

Audit
# Check Admin API binding
grep 'admin_listen' /etc/kong/kong.conf
curl -s http://localhost:8001/status
Remediation
# Restrict Admin API to localhost
# In kong.conf:
# admin_listen = 127.0.0.1:8001 ssl
# admin_ssl_cert = /etc/kong/ssl/admin-cert.pem
# admin_ssl_cert_key = /etc/kong/ssl/admin-key.pem
# Do NOT expose admin API on 0.0.0.0
2.1.2 Ensure RBAC is enabled for Admin API access (Automated)
L1 Auto
Description

This recommendation verifies that RBAC is enabled for Admin API access on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check RBAC configuration
grep -E 'enforce_rbac|admin_gui_auth' /etc/kong/kong.conf
curl -s http://localhost:8001/rbac/users | head -20
Remediation
# Enable RBAC for Admin API
# In kong.conf:
# enforce_rbac = on
# admin_gui_auth = basic-auth
# admin_gui_session_conf = {"secret":"s3cret","cookie_secure":true}
# Create admin users with specific roles via Admin API

3 — TLS Configuration

▶

3.1 Proxy & Upstream TLS

▶
3.1.1 Ensure proxy listeners use TLS 1.2+ with strong ciphers (Automated)
L1 Auto
Description

This recommendation verifies that proxy listeners use TLS 1.2+ with strong ciphers on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check proxy TLS configuration
grep -E 'proxy_listen|ssl_cert|ssl_protocols' /etc/kong/kong.conf
Remediation
# Configure proxy TLS
# In kong.conf:
# proxy_listen = 0.0.0.0:8443 ssl
# ssl_cert = /etc/kong/ssl/cert.pem
# ssl_cert_key = /etc/kong/ssl/key.pem
# ssl_protocols = TLSv1.2 TLSv1.3
# ssl_ciphers = ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384
3.1.2 Ensure upstream connections use TLS with verification (Automated)
L1 Auto
Description

This recommendation verifies that upstream connections use TLS with verification on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check upstream TLS
curl -s http://localhost:8001/upstreams | python3 -m json.tool | grep -E 'https|tls' | head -10
Remediation
# Configure mutual TLS for upstreams
curl -s -X PATCH http://localhost:8001/upstreams/{upstream_id} \
  -d 'https_verify=true' \
  -d 'https_verify_depth=2' \
# In kong.conf:
# upstream_keepalive_pool_size = 60
# upstream_keepalive_max_requests = 100

4 — Logging & Monitoring

▶

4.1 Access & Error Logs

▶
4.1.1 Ensure access logging plugin is enabled (Automated)
L1 Auto
Description

This recommendation verifies that access logging plugin is enabled on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check logging plugins
curl -s http://localhost:8001/plugins | python3 -m json.tool | grep -E 'file-log|syslog|http-log'
Remediation
# Enable access logging
curl -s -X POST http://localhost:8001/plugins \
  -d 'name=file-log' \
  -d 'config.path=/var/log/kong/access.log' \
  -d 'config.reopen=true'
# Or use syslog plugin:
curl -s -X POST http://localhost:8001/plugins \
  -d 'name=syslog' \
  -d 'config.facility=local0'
4.1.2 Ensure error logging with rotation is configured (Automated)
L1 Auto
Description

This recommendation verifies that error logging with rotation is configured on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check error log configuration
grep -E 'proxy_error_log|admin_error_log|log_level' /etc/kong/kong.conf
Remediation
# Configure error logging
# In kong.conf:
# proxy_error_log = /var/log/kong/error.log
# admin_error_log = /var/log/kong/admin-error.log
# log_level = notice
# Configure log rotation:
cat > /etc/logrotate.d/kong << 'EOF'
/var/log/kong/*.log {
    daily
    rotate 30
    compress
    missingok
}
EOF

5 — Traffic Control

▶

5.1 Rate Limiting & Authentication

▶
5.1.1 Ensure rate limiting plugin is configured (Automated)
L1 Auto
Description

This recommendation verifies that rate limiting plugin is configured on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check rate limiting plugin
curl -s http://localhost:8001/plugins | python3 -m json.tool | grep 'rate-limiting'
Remediation
# Enable rate limiting
curl -s -X POST http://localhost:8001/plugins \
  -d 'name=rate-limiting' \
  -d 'config.minute=100' \
  -d 'config.hour=1000' \
  -d 'config.policy=redis' \
  -d 'config.redis_host=redis.internal'
5.1.2 Ensure authentication plugins are enabled on routes (Automated)
L1 Auto
Description

This recommendation verifies that authentication plugins are enabled on routes on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check authentication plugins
curl -s http://localhost:8001/plugins | python3 -m json.tool | grep -E 'key-auth|jwt|oauth2|basic-auth'
Remediation
# Enable authentication on routes
curl -s -X POST http://localhost:8001/routes/{route_id}/plugins \
  -d 'name=key-auth'
# Or JWT auth:
curl -s -X POST http://localhost:8001/routes/{route_id}/plugins \
  -d 'name=jwt'
# Create consumer credentials:
curl -s -X POST http://localhost:8001/consumers \
  -d 'username=app1'

6 — Request Security

▶

6.1 IP Restriction & Payload

▶
6.1.1 Ensure IP restriction and CORS plugins are configured (Automated)
L1 Auto
Description

This recommendation verifies that IP restriction and CORS plugins are configured on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check CORS and IP restriction plugins
curl -s http://localhost:8001/plugins | python3 -m json.tool | grep -E 'cors|ip-restriction|bot-detection'
Remediation
# Configure request security plugins
# IP restriction:
curl -s -X POST http://localhost:8001/plugins \
  -d 'name=ip-restriction' \
  -d 'config.allow=10.0.0.0/8'
# CORS:
curl -s -X POST http://localhost:8001/plugins \
  -d 'name=cors' \
  -d 'config.origins=https://app.example.com' \
  -d 'config.methods=GET,POST' \
  -d 'config.credentials=true'
6.1.2 Ensure request size limiting and header sanitization are configured (Automated)
L1 Auto
Description

This recommendation verifies that request size limiting and header sanitization are configured on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check request size and transformation
curl -s http://localhost:8001/plugins | python3 -m json.tool | grep -E 'request-size-limiting|request-transformer'
Remediation
# Configure request security
curl -s -X POST http://localhost:8001/plugins \
  -d 'name=request-size-limiting' \
  -d 'config.allowed_payload_size=10'
# Remove sensitive headers:
curl -s -X POST http://localhost:8001/plugins \
  -d 'name=request-transformer' \
  -d 'config.remove.headers=X-Internal-Token'

7 — Maintenance & Hardening

▶

7.1 Database & Permissions

▶
7.1.1 Ensure database connections use TLS with certificate verification (Automated)
L1 Auto
Description

This recommendation verifies that database connections use TLS with certificate verification on the Kong Gateway API gateway. Implementing this control strengthens the overall security configuration and reduces exposure to potential threats.

Rationale

Failure to implement this control may leave the Kong Gateway API gateway vulnerable to attack or non-compliant with organizational security policies. This control helps establish a consistent, hardened configuration baseline.

Audit
# Check database configuration
grep -E 'database|pg_host|pg_ssl' /etc/kong/kong.conf
Remediation
# Harden database connection
# In kong.conf:
# database = postgres
# pg_host = db.internal
# pg_port = 5432
# pg_ssl = on
# pg_ssl_verify = on
# pg_ssl_cert = /etc/kong/ssl/pg-client.pem
# pg_ssl_cert_key = /etc/kong/ssl/pg-client-key.pem
7.1.2 Ensure configuration file permissions are restricted (Automated)
L1 Auto
Description

This setting ensures that configuration file permissions are restricted on the Kong Gateway API gateway. Restricting this capability limits potential abuse and enforces the principle of least privilege across the environment.

Rationale

Unrestricted access to this capability could allow unauthorized users or processes to perform actions beyond their intended scope. Applying least-privilege principles to the Kong Gateway API gateway is essential for defense in depth.

Audit
# Check configuration file permissions
stat -c '%a %U %G' /etc/kong/kong.conf
find /etc/kong -type f -exec stat -c '%a %n' {} \;
Remediation
# Restrict configuration permissions
chmod 640 /etc/kong/kong.conf
chown root:kong /etc/kong/kong.conf
chmod 600 /etc/kong/ssl/*.pem
chmod 750 /etc/kong/