Infisical Security Testing: Default Credentials, API Token, Database, and Encryption Key

Infisical is a widely deployed open-source secrets management platform (HashiCorp Vault/Doppler alternative) used to centralize all application credentials — API keys, database passwords, OAuth secrets, and service tokens. Compromising Infisical is uniquely high-impact because it is a secrets aggregator: a single compromise can expose every credential stored across all connected applications and environments. Key assessment areas: ENCRYPTION_KEY in .env is used to decrypt all stored secrets in the database, enabling mass credential extraction; JWT_SECRET enables session token forgery; MONGO_URL provides MongoDB access to all encrypted secret ciphertext; the API allows enumerating all secret values across projects; and machine identity tokens provide long-lived non-expiring API access. This guide covers systematic Infisical security assessment.

Table of Contents

  1. Authentication and Machine Identity Token Testing
  2. API Secret Value Enumeration Across All Projects
  3. ENCRYPTION_KEY and MongoDB Credential Extraction
  4. Infisical Security Hardening

Authentication and Machine Identity Token Testing

# Infisical — authentication and machine identity token testing
INFISICAL_URL="https://infisical.example.com"

# Infisical admin login
AUTH_RESPONSE=$(curl -s -X POST "${INFISICAL_URL}/api/v1/auth/login1" \
  -H "Content-Type: application/json" \
  -d '{"email":"admin@example.com","clientPublicKey":"..."}' 2>/dev/null)
# Infisical uses SRP authentication — direct password login is complex
# Use service tokens or machine identity tokens for API testing

# Machine identity token — created for CI/CD automation (long-lived)
# GET /api/v1/machine-identities — list all machine identities (admin only)
ACCESS_TOKEN="your-access-token-or-service-token"

curl -s "${INFISICAL_URL}/api/v1/workspace" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" 2>/dev/null | python3 -c "
import json,sys
d=json.load(sys.stdin)
workspaces = d.get('workspaces',[])
print(f'Workspaces: {len(workspaces)}')
for w in workspaces:
    print(f'  [{w.get(\"id\")}] {w.get(\"name\")} envs={[e.get(\"slug\") for e in w.get(\"environments\",[])]}')
" 2>/dev/null

# Service token — generated per project with configurable permissions
SERVICE_TOKEN="st.your-service-token.value"
curl -s "${INFISICAL_URL}/api/v3/secrets?workspaceId=WORKSPACE_ID&environment=production" \
  -H "Authorization: Bearer ${SERVICE_TOKEN}" 2>/dev/null | python3 -c "
import json,sys
d=json.load(sys.stdin)
secrets = d.get('secrets',[])
print(f'Secrets: {len(secrets)}')
for s in secrets[:10]:
    print(f'  {s.get(\"secretKey\")} = {s.get(\"secretValue\")[:30] if s.get(\"secretValue\") else \"[encrypted]\"}')
" 2>/dev/null

API Secret Value Enumeration Across All Projects

# Infisical REST API — secret value enumeration across all projects
INFISICAL_URL="https://infisical.example.com"
ACCESS_TOKEN="your-admin-access-token"

# List all workspaces (projects)
curl -s "${INFISICAL_URL}/api/v1/workspace" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" 2>/dev/null | python3 -c "
import json,sys
d=json.load(sys.stdin)
workspaces = d.get('workspaces',[])
for w in workspaces:
    wid = w.get('id')
    name = w.get('name')
    envs = [e.get('slug') for e in w.get('environments',[])]
    print(f'Workspace: {name} ({wid}) envs: {envs}')
" 2>/dev/null

WORKSPACE_ID="your-workspace-id"

# Get all secrets in a workspace — returns plaintext values for authorized tokens
for ENV in production staging development; do
  echo "=== Environment: ${ENV} ==="
  curl -s "${INFISICAL_URL}/api/v3/secrets?workspaceId=${WORKSPACE_ID}&environment=${ENV}&secretPath=/" \
    -H "Authorization: Bearer ${ACCESS_TOKEN}" 2>/dev/null | python3 -c "
import json,sys
d=json.load(sys.stdin)
secrets = d.get('secrets',[])
print(f'Secrets in ${ENV}: {len(secrets)}')
for s in secrets:
    key = s.get('secretKey','')
    val = s.get('secretValue','')
    if any(k in key.upper() for k in ['KEY','SECRET','TOKEN','PASSWORD','PASS','PRIVATE','STRIPE','AWS','GOOGLE','SLACK']):
        print(f'  [SENSITIVE] {key} = {val[:50]}')
" 2>/dev/null
done

# Admin — list all users on the Infisical instance
curl -s "${INFISICAL_URL}/api/v1/admin/user-management" \
  -H "Authorization: Bearer ${ACCESS_TOKEN}" 2>/dev/null | python3 -c "
import json,sys
d=json.load(sys.stdin)
users = d.get('users',[])
print(f'Users: {len(users)}')
for u in users[:10]:
    print(f'  [{u.get(\"id\")}] {u.get(\"email\")} superAdmin={u.get(\"superAdmin\")} verified={u.get(\"isEmailVerified\")}')
" 2>/dev/null

ENCRYPTION_KEY and MongoDB Credential Extraction

# Infisical .env ENCRYPTION_KEY and MongoDB credential extraction

# .env file — Infisical's critical secrets
cat /app/.env 2>/dev/null | grep -E "ENCRYPTION_KEY|JWT_SECRET|MONGO_URL|REDIS|AUTH_SECRET"
# ENCRYPTION_KEY — 16-byte hex key used to AES-encrypt all stored secrets
# JWT_SECRET — JWT signing secret for session tokens
# MONGO_URL — MongoDB connection string with credentials
# JWT_AUTH_SECRET — authentication JWT signing key

# Docker deployment
docker inspect infisical 2>/dev/null | python3 -c "
import json,sys
d=json.load(sys.stdin)
for c in d:
    for e in c.get('Config',{}).get('Env',[]):
        if any(k in e for k in ['ENCRYPTION_KEY','JWT_SECRET','MONGO_URL','AUTH_SECRET','REDIS']):
            print(e)
" 2>/dev/null

# MongoDB access — all encrypted secrets in the database
MONGO_URL="mongodb://infisical:PASSWORD@localhost/infisical"
mongosh "$MONGO_URL" 2>/dev/null --eval "
// List all collections
db.getCollectionNames()
"

# secrets collection — all stored secrets (AES-encrypted with ENCRYPTION_KEY)
mongosh "$MONGO_URL" 2>/dev/null --eval "
db.secrets.find({}, {secretKeyIV:1, secretKeyTag:1, secretKeyCiphertext:1,
                      secretValueIV:1, secretValueTag:1, secretValueCiphertext:1,
                      workspace:1, environment:1}).limit(10)
"
# With ENCRYPTION_KEY, decrypt using AES-256-GCM:
# node -e "
# const crypto = require('crypto');
# const ENCRYPTION_KEY = Buffer.from('extracted-key', 'hex');
# function decrypt(ciphertext, iv, tag) {
#   const decipher = crypto.createDecipheriv('aes-256-gcm', ENCRYPTION_KEY, Buffer.from(iv,'base64'));
#   decipher.setAuthTag(Buffer.from(tag,'base64'));
#   return decipher.update(Buffer.from(ciphertext,'base64'),'binary','utf8') + decipher.final('utf8');
# }
# // Apply to each secret in database
# "

# workspaces collection — all projects
mongosh "$MONGO_URL" 2>/dev/null --eval "
db.workspaces.find({}, {name:1, environments:1}).limit(20)
"

Infisical Security Hardening

Infisical Security Hardening Checklist:
Security TestMethodRisk
ENCRYPTION_KEY extraction and mass secret decryptionRead .env ENCRYPTION_KEY — AES-256-GCM decryption key for all stored secrets; combined with MongoDB access, decrypt every credential across all projects and environmentsCritical (catastrophic blast radius)
API secret value enumeration across all workspacesGET /api/v3/secrets with admin token — returns plaintext secret values for all environments; complete harvest of all stored API keys, database passwords, and service credentialsCritical
JWT_SECRET extraction and session token forgeryRead .env JWT_SECRET — JWT signing key; forge valid session tokens as any Infisical user including admins; combined with API access, read all stored secrets without ENCRYPTION_KEYCritical
MONGO_URL credential extraction and ciphertext accessRead .env MONGO_URL — MongoDB connection credentials; access to all secret ciphertext; combined with ENCRYPTION_KEY, enables offline decryption of all stored secretsCritical
Machine identity token enumeration and privilege escalationGET /api/v1/machine-identities — all machine identities with associated permissions; identify over-privileged tokens that access production secrets from CI/CD contextsHigh

Automate Infisical Security Testing

Ironimo tests Infisical deployments for ENCRYPTION_KEY extraction and AES-256-GCM secret decryption capability assessment, JWT_SECRET session token forgery, MONGO_URL MongoDB credential extraction with ciphertext access, API secret enumeration across all workspaces and environments, machine identity token privilege audit, admin panel network exposure, MongoDB authentication bypass testing, service token scope misconfiguration, Docker environment variable credential exposure, and user enumeration via the admin API.

Start free scan