Koding Siber Logo
Koding Siber
Academy CatalogAPI SecurityConfiguration and Inventory Management
Beginner Level35 minsFree Preview Module
Category: Configuration and Inventory Management

Security Misconfiguration

Learn about API-specific security misconfigurations in frameworks, gateways, and cloud services.

EXPLORERINTERACTIVE
Security Misconfiguration
HTTP
INFO:GET /api/v2/customers/1092/private_records [Auth: Bob]
API Consumer (Bob)(192.168.1.10)
Legitimate authenticated mobile client or developer terminal. Possesses a valid JWT token for User Bob, but tampers with URI IDs to request other users' records.
SIMULATION CONTROLSStep 1 of 5
Simulation Speed:
Simulation paused (click Play Flow or Next Step)
STEP 1 OF 5

TAMPER OBJECT IDENTIFIER

Client substitutes foreign resource ID

User 'Bob' observes legitimate endpoint structure and tampers with the object ID parameter, requesting data belonging to User 'Alice' to test for Security Misconfiguration.

Payload / Code Inspector
GET /api/v2/customers/1092/private_records HTTP/1.1
Host: api.gateway.corp
Authorization: Bearer <Bob_Valid_JWT>
Defensive Mitigation
Implement object-level access control checks (validating that req.user.id === record.ownerId) on every single resource retrieval and update.

PACKET FLOW (WIRESHARK INSPECTOR)

Click any row to jump to step
NO.TIMESOURCEDESTINATIONPROTOCOLINFOSIZE
10.000s192.168.1.10api.gateway.corpHTTPGET /api/v2/customers/1092/private_records [Auth: Bob]162 B
20.015sapi.gateway.corp10.0.1.25JSONRPC: Forwarding request to Account Microservice198 B
30.028s10.0.1.2510.0.2.90SQLQUERY: SELECT * FROM customers WHERE id = 1092174 B
40.041s10.0.2.9010.0.1.25SQLDATA: [id=1092, owner=Alice, balance=$92k]270 B
50.056s10.0.1.25192.168.1.10HTTPHTTP/1.1 200 OK [Alice's Confidential Data returned to Bob]356 B
Payload Inspector
STEP 1
API Consumer (Bob)➔API Gateway
HTTP
Transmitted Data
162 B
GET /api/v2/customers/1092/private_records HTTP/1.1
Host: api.gateway.corp
Authorization: Bearer <Bob_Valid_JWT>
Client substitutes foreign resource IDINSPECTED
Vulnerability Overview

What is Security Misconfiguration?

Learn about API-specific security misconfigurations in frameworks, gateways, and cloud services. In production environments, this flaw typically arises when applications process untrusted input or misconfigure architectural security controls.
Impact
Exposes internal details and expands the attack surface.
Severity
MEDIUM
Technical Mechanism & Code Flaw

Root Cause Analysis

The vulnerability exists because user-controlled data or unhardened security flags are executed under improper security contexts.
Vulnerable Implementation (Anti-Pattern)UNSAFE
// BAD: Untrusted execution or unhardened configuration
const config = { debug: true, allowUnauthenticated: true };
app.use('/api', createService(config));
Secure Implementation (Hardened)SECURED
// GOOD: Strict hardening and defense-in-depth
const config = { debug: false, allowUnauthenticated: false, authRequired: true };
app.use('/api', authenticate, createService(config));
Detection & Penetration Testing Methodology

Detection & Penetration Testing Methodology

Tools Used in This Manual

Tool Purpose
Nikto Automated scan for debug paths, default files, sample pages, dangerous HTTP methods, and common misconfigurations in one pass
ffuf / gobuster Directory and path discovery (debug consoles, admin paths, asset directories)
Nmap (http-methods, http-enum scripts) Enumerate allowed HTTP methods and common paths per host
Burp Suite (Repeater) Manual confirmation of anything the scanners flag

Overview

Security misconfiguration covers the "low-hanging fruit" category -- things that aren't a flaw in the application's logic, but a flaw in how it was deployed: debug consoles left reachable, directory listing exposing files it shouldn't, dangerous HTTP methods left enabled, or sample/default content never cleaned up after setup. These are exactly the kind of findings automated scanners excel at, since they're pattern-matchable against known file paths and known default configurations.

This lab covers 5 steps:

Check for reachable debug/admin paths and stack traces

Check for directory listing on asset/upload directories

Enumerate allowed HTTP methods per endpoint

Check for default/sample pages and accounts

Document each misconfiguration with the revealing request

Step 1 -- Debug/Administrative Paths and Stack Traces

Goal: Many frameworks ship with a debug console or verbose error page that should be disabled in production -- find out if it's still reachable.

1.1 Run Nikto for a broad first pass

nikto -h https://target.com

Nikto's default database already checks for dozens of known debug/admin paths (/phpinfo.php, /.git/, /server-status, framework-specific debug routes) and reports each one it finds reachable, with the exact path and response code -- no manual list needed.

1.2 Target framework-specific debug consoles with ffuf, if Nikto doesn't cover a newer framework

ffuf -u https://target.com/FUZZ -w debug_paths.txt -mc 200,500

Where debug_paths.txt is a small curated list for the specific framework identified earlier (Django's /admin/, Rails' /rails/info/properties, Spring Boot's /actuator/, Laravel's /_ignition/health-check) -- SecLists' repository has ready-made wordlists for most major frameworks under its "Discovery/Web-Content" category.

1.3 Trigger an error deliberately to check stack trace verbosity

Send an obviously malformed request (via Burp Repeater -- e.g. an extra unexpected parameter, a broken content-type) and check whether the resulting error page reveals a full stack trace, file paths, or library version numbers instead of a generic error message.

1.4 Reading results

Finding Meaning
Debug console loads and allows interaction (e.g. Django admin, Spring Boot actuator with write endpoints) Confirmed -- critical
Stack trace reveals file paths, framework version, or query details Confirmed -- information disclosure
Generic error page, no console reachable Properly configured

Step 2 -- Directory Listing

Goal: Check whether common asset/upload directories expose a raw file listing instead of a proper 403/404.

2.1 Nikto already checks this as part of its default scan

The Step 1.1 Nikto run flags directory listing findings automatically if encountered during its crawl -- check its output for "Directory indexing found" style entries.

2.2 Target specific common directories directly with ffuf

ffuf -u https://target.com/FUZZ/ -w common_dirs.txt -mc 200

Where common_dirs.txt includes typical candidates: uploads, assets, files, images, backup, tmp, media, static, old, .git.

2.3 Confirm manually

Open any flagged directory URL directly in a browser -- a true directory listing shows an auto-generated HTML page with clickable file/folder links (Apache's classic "Index of /..." style page) rather than the app's normal UI or a 403.

Step 3 -- Enumerate Allowed HTTP Methods

Goal: Check which HTTP methods each endpoint accepts -- OPTIONS, TRACE, PUT, DELETE being unexpectedly enabled can allow unintended actions or information disclosure.

3.1 Nmap's http-methods script -- fastest broad check

nmap -p 80,443 --script http-methods --script-args http-methods.url-path='/' target.com

This reports every method the server accepts at the given path in one pass, and specifically flags "potentially risky methods" like PUT, DELETE, TRACE in its output.

3.2 Check OPTIONS directly for a specific endpoint, via curl's simplicity

curl -s -i -X OPTIONS https://target.com/api/users

The Allow: response header lists exactly which methods that specific endpoint accepts -- repeat this across your list of important/sensitive endpoints found during earlier recon.

3.3 Test whether a state-changing method actually works, not just whether it's "allowed"

A server reporting PUT in its Allow header doesn't always mean a PUT request has a real effect -- confirm in Burp Repeater by actually sending a PUT/DELETE to a test resource and checking whether it succeeds:

curl -s -i -X DELETE https://target.com/api/resource/test123

3.4 Check for TRACE method specifically (XST -- Cross-Site Tracing)

curl -s -i -X TRACE https://target.com/ -H "X-Custom: test"

If the response echoes back your custom header exactly, TRACE is enabled -- this can be combined with other weaknesses (like inadequate HttpOnly cookie protection) to read cookies via XST in older browsers.

Step 4 -- Default/Sample Pages and Accounts

Goal: Check whether content that ships with a framework/server by default -- example pages, demo accounts -- was left in place after deployment.

4.1 Nikto covers this too, as part of the same scan from Step 1

Nikto's database specifically checks for well-known sample files (Tomcat's /examples/, Apache's default welcome page remnants, phpMyAdmin's setup scripts) as part of its default run -- no separate command needed if you already ran Step 1.1.

4.2 Check default credentials -- reuse the Step 1 approach from the Broken Authentication manual

nmap -p 80,443,8080 --script http-default-accounts target.com

This is the same tool/script used earlier for default-credential testing -- directly relevant here too, since "a default account left in place" is itself a security misconfiguration finding, not just a separate category.

4.3 Check for leftover setup/installer scripts specifically

ffuf -u https://target.com/FUZZ -w installer_paths.txt -mc 200

Common candidates: /install.php, /setup.php, /wp-admin/install.php, /phpmyadmin/setup/.

Step 5 -- Document Each Misconfiguration

Goal: Export directly from each scanner's native output format.

5.1 Nikto's built-in reporting

nikto -h https://target.com -o evidence_nikto_report.html -Format html

Nikto generates a clean, readable report in one command -- no manual write-up needed for anything it found.

5.2 Nmap script output

nmap -p 80,443,8080 --script http-methods,http-default-accounts target.com -oN evidence_nmap_methods.txt

5.3 ffuf JSON output

ffuf -u https://target.com/FUZZ -w debug_paths.txt -mc 200,500 -o evidence_ffuf_debug.json -of json

5.4 Manual confirmations via Burp

For anything confirmed by hand (actual DELETE working, a stack trace's content), save the Repeater request/response pair directly.

Evidence Table Template:

No. Misconfiguration Tool Used Finding Conclusion
1 Debug console reachable Nikto Spring Boot Actuator /actuator/env exposed Confirmed -- critical
2 Verbose stack trace Burp Repeater (malformed request) File paths and library versions disclosed Confirmed
3 Directory listing Nikto + ffuf /uploads/ returns raw file index Confirmed
4 Risky HTTP method enabled Nmap http-methods PUT and DELETE both listed as allowed Confirmed -- needs manual impact test
5 DELETE actually functional Burp Repeater (manual DELETE test) Test resource successfully deleted Confirmed -- critical
6 TRACE enabled curl (manual XST check) Custom header echoed back in response Confirmed
7 Default admin account Nmap http-default-accounts admin:admin succeeded on Tomcat Manager Confirmed -- critical
8 Leftover installer script ffuf /install.php returns 200, setup wizard loads Confirmed

Proof of Concept

[Insert the exact request and payload that demonstrate the vulnerability, and the resulting response.]

Evidence

[Insert screenshot or HTTP request/response excerpt -- Figure F-26-1.]

Remediation

Disable debug mode and verbose error output in production.

Disable directory listing and remove default/sample content before go-live.

Restrict allowed HTTP methods per endpoint to those actually required, and disable TRACE globally.

Adopt a documented, version-controlled hardening baseline applied consistently across environments.

Re-test the configuration after remediation.

Retest Notes

[ ] Not yet retested [ ] Retested -- Resolved [ ] Retested -- Not resolved. [Retest date and tester name.]

References

CWE-16 CWE-548 CWE-650 OWASP Top 10:2021 OWASP WSTG

Hands-on Lab Exercise

Lab Scenario

Launch your local laboratory environment (e.g., OWASP Juice Shop, DVWA, or crAPI) to verify this vulnerability.

$ curl -X POST http://127.0.0.1:8080/api/target \ -d "probe=api-security-misconfiguration"
• Goal: Verify vulnerable state behavior and apply defense
• Solution: Enforce defense-in-depth and strict validation
Knowledge Check
ASSESSMENT

What is the primary, most effective defense mechanism against Security Misconfiguration?

Next Module in Configuration and Inventory Management
Improper API Inventory Management
Continue to Next Module