Damn Vulnerable Web API - An intentionally insecure REST API for security testing and training.
Warning
Running this on the open internet will leave the host vulnerable. It is recommended to use the supplied container in a restricted access environment instead. If you choose to host this on the public internet you do so at your own risk!!
DVWAPI is a deliberately vulnerable web application designed for learning and practicing web API security testing. It contains common vulnerabilities found in web APIs including exposed sensitive endpoints, lack of authentication, and information disclosure.
Pull and run the latest image from Docker Hub:
docker pull trapdoorsec/dvwapi:latest
docker run -d -p 7341:7341 --name dvwapi trapdoorsec/dvwapi:latestThe API will be available at http://localhost:7341
docker-compose up -d# Build locally
make build
# Run container
make run
# View logs
make logs
# Stop container
make stopcargo build --releaseThe compiled binary will be available at target/release/dvwapi.
Build locally:
docker build -t dvwapi:latest .Or use the Makefile:
make buildPull the latest image:
docker pull trapdoorsec/dvwapi:latestRun the container:
docker run -d -p 7341:7341 --name dvwapi trapdoorsec/dvwapi:latestRun with custom options:
docker run -d -p 8080:8080 --name dvwapi trapdoorsec/dvwapi:latest --port 8080 --log-level debugStop the container:
docker stop dvwapi
docker rm dvwapiStart the service:
docker-compose up -dView logs:
docker-compose logs -fStop the service:
docker-compose downRun with default settings (0.0.0.0:7341):
./dvwapi-i, --ip <IP>- IP address to bind to (default: 0.0.0.0)-p, --port <PORT>- Port number to listen on (default: 7341)-c, --colored <true|false>- Enable colored console logging (default: true)-l, --log-level <LEVEL>- Set log level: trace, debug, info, warn, error (default: info)
# Bind to localhost on port 8080
./dvwapi --ip 127.0.0.1 --port 8080
# Enable debug logging
./dvwapi --log-level debug
# Disable colored output
./dvwapi --colored falseThe API supports three versions with different response formats and features.
GET /- API status (returns v1 format)
Public Endpoints:
GET /api/v1/- API version infoGET /api/v1/users- List all usersGET /api/v1/users/{id}- Get user by IDPOST /api/v1/users- Create new user
Vulnerable Endpoints:
GET /api/v1/debug/config- Exposes secretsGET /api/v1/admin- Admin panelGET /api/v1/.env- Environment fileGET /api/v1/env- Dumps environment variables (AWS keys, DB credentials, etc.)
Returns data wrapped in data and meta objects with timestamps.
Public Endpoints:
GET /api/v2/- API version infoGET /api/v2/users- List users with metadataGET /api/v2/users/{id}- Get user with metadataPOST /api/v2/users- Create user with metadata
Vulnerable Endpoints:
GET /api/v2/debug/config- Configuration with additional secretsGET /api/v2/admin- Admin panelGET /api/v2/.env- Environment fileGET /api/v2/env- Dumps environment variables with metadata
Returns structured responses with status, data, and metadata including request IDs.
Public Endpoints:
GET /api/v3/- API version info with endpoint listGET /api/v3/health- Health check endpoint (also:/healthz,/healthcheck,/ready,/readyz,/live,/livez,/status)GET /api/v3/ping- Ping endpointGET /api/v3/users- List users with pagination infoGET /api/v3/users/{id}- Get user with permissionsPOST /api/v3/users- Create user with full metadata
Vulnerable Endpoints:
GET /api/v3/debug/config- Exposes production secrets including JWTGET /api/v3/admin- Admin panelGET /api/v3/.env- Environment fileGET /api/v3/env- Full environment variable dump with severity warnings
The API has intentionally vulnerable endpoints that allow command injection through path parameters:
GET /api/{version}/version-info- Version validation with command injectionGET /api/{version}/check- API version check with command injection
The API exposes Swagger/OpenAPI documentation endpoints with RCE vulnerabilities through unsafe spec generation:
GET /swagger- Swagger UI documentation viewerGET /redoc- ReDoc documentation viewerGET /swagger.json- Swagger JSON specGET /api-docs- API documentationGET /swagger/generate?title={value}- Generate custom spec (vulnerable to command injection)GET /swagger/upload/{spec}- Upload custom spec (vulnerable to command injection)
Exploitation Examples:
# Execute whoami command via query parameter
curl http://localhost:7341/swagger/generate?title=\$\(whoami\)
# Execute id command
curl http://localhost:7341/swagger/generate?title=API\;id\;
# Execute commands via upload endpoint
curl http://localhost:7341/swagger/upload/test\;whoami\;
# Chain multiple commands
curl "http://localhost:7341/swagger/generate?title=API\;ls%20-la\;pwd"The vulnerability exists because the endpoints use shell commands to "validate" user input during spec generation.
The API includes GraphQL endpoints with intentional vulnerabilities:
GET /graphql- GraphQL Playground (interactive query interface)POST /graphql- GraphQL API endpointGET /graphql/playground- Alternative playground URL
Available Queries:
# Get all users
query {
users {
id
name
}
}
# Get user by ID
query {
user(id: 1) {
id
name
}
}
# VULNERABLE: Exposed secrets
query {
secrets {
key
value
}
}
# VULNERABLE: System information exposure
query {
systemInfo {
hostname
platform
arch
version
}
}Available Mutations:
# Create a new user
mutation {
createUser(name: "Alice") {
id
name
}
}
# VULNERABLE: Delete user without authentication
mutation {
deleteUser(id: 1)
}
# VULNERABLE: Execute arbitrary query
mutation {
executeQuery(query: "{ users { id } }")
}Security Issues:
- Full introspection enabled
- No authentication or authorization
- Secrets exposed via queries
- System information disclosure
- Unrestricted mutations
The API mimics Spring Boot Actuator management endpoints with critical vulnerabilities:
GET /actuator- Actuator index (lists all available management endpoints)GET /actuator/health- Health check with detailed component informationGET /actuator/env- CRITICAL: Exposes ALL configuration including secrets, credentials, and environment variablesGET /actuator/heapdump- CRITICAL: Simulated heap dump exposing sensitive data from memoryPOST /actuator/shutdown- CRITICAL: Unauthenticated application shutdown endpoint
Example Usage:
# List all actuator endpoints
curl http://localhost:7341/actuator
# Check application health
curl http://localhost:7341/actuator/health
# VULNERABILITY: Dump all configuration and secrets
curl http://localhost:7341/actuator/env
# VULNERABILITY: Generate heap dump with sensitive data
curl http://localhost:7341/actuator/heapdump
# VULNERABILITY: Shutdown the application without authentication
curl -X POST http://localhost:7341/actuator/shutdownSecurity Issues:
- No authentication or authorization on any endpoint
- Complete environment variable exposure (database passwords, API keys, AWS credentials, JWT secrets, etc.)
- Heap dump contains simulated sensitive data (passwords, tokens, credit cards, private keys)
- Shutdown endpoint allows anonymous DoS attacks
- Detailed system information disclosure
- Production configuration fully exposed
These endpoints simulate common misconfigurations in Spring Boot applications where actuator endpoints are exposed without proper security.
Run the test suite:
cargo testOr use the Makefile:
make cargo-test- Docker Hub account
- Docker installed and logged in (
docker login)
Using the Makefile (recommended):
# Login to Docker Hub
make login
# Build, push, and tag
make publishOr manually:
# Build the image
docker build -t trapdoorsec/dvwapi:latest -t trapdoorsec/dvwapi:0.1.0 .
# Push to Docker Hub
docker push trapdoorsec/dvwapi:latest
docker push trapdoorsec/dvwapi:0.1.0
# Tag git commit
git tag -a v0.1.0 -m "Release v0.1.0"
git push origin v0.1.0latest- Latest stable release0.1.0- Specific version (matches Cargo.toml version)- Version tags follow semantic versioning
Copy .env.example to .env and customize:
cp .env.example .envAvailable variables:
DOCKER_REPO- Docker Hub repository (default: trapdoorsec/dvwapi)TAG- Image tag (default: latest)HOST_PORT- Host port mapping (default: 7341)LOG_LEVEL- Application log level (default: info)
The project includes a Makefile for common operations:
make help # Show all available commands
make build # Build Docker image
make run # Run container
make stop # Stop container
make logs # View container logs
make push # Push to Docker Hub
make publish # Build, push, and tag (full release)
make compose-up # Start with docker-compose
make compose-down # Stop docker-compose
make cargo-build # Build Rust binary
make cargo-test # Run tests
make clean # Clean upThis application is intentionally vulnerable and should only be used in controlled environments for educational purposes. Do not deploy this on public networks or production systems.
This project is provided as-is for educational purposes only.