Security Testing
Security testing examines how an application behaves when requests, identities and inputs do not follow the expected user interface flow.
Understand the system and trust boundaries
|
v
Define authorized test scope
|
v
Observe and modify controlled requests
|
v
Validate security controls
|
v
Report, fix and retest
One-line idea: Security testing verifies that the server protects data and operations even when a client sends unexpected, modified or unauthorized requests.
Authorization and Safety First
Security testing must be performed only on systems you own or have explicit permission to test.
Before testing, define:
- systems, domains, APIs and accounts in scope
- allowed tools and techniques
- testing dates and traffic limits
- prohibited actions
- data-handling rules
- emergency stop contacts
- reporting and evidence requirements
Permission + clear scope + safety limits
|
v
Authorized security test
Do not test unrelated public systems, third-party services or real user accounts. Automated requests can cause outages, trigger defenses, lock accounts or create costs even when the tester has no harmful intention.
Use dedicated test environments and accounts whenever possible. Production testing requires additional approval and safeguards.
Core Security Model
The Frontend Is Not a Security Boundary
Browser validation improves user experience, but a user controls the browser and request.
An attacker can bypass:
- disabled buttons
- hidden form fields
- client-side role checks
- JavaScript validation
- route guards
- values stored in local storage
The server must independently validate and authorize every operation.
Frontend says: userId = 100
|
Request can be changed to: userId = 101
|
v
Server must verify whether the caller may access user 101
Trust Boundaries
A trust boundary is a point where data or control moves between components with different trust levels.
Common boundaries include:
- browser to API
- public API to internal service
- application to database
- service to third-party provider
- administrator tools to production systems
- uploaded file to storage or processing service
Security testing asks what happens when data crossing a boundary is missing, malformed, replayed, reordered or sent by the wrong identity.
Server-Side Responsibilities
The server must enforce:
- authentication
- authorization
- input validation
- business rules
- rate and resource limits
- secure session behavior
- safe output encoding where relevant
- audit logging
Never rely on a client to decide what it is allowed to do.
Security Testing Approaches
Different methods find different problems.
| Approach | What it examines | Example purpose |
|---|---|---|
| Threat modeling | Architecture, assets and abuse paths | Identify high-risk flows before implementation |
| Secure code review | Source code and control flow | Find missing authorization or unsafe data handling |
| SAST | Source or compiled code patterns | Detect suspicious coding patterns early |
| SCA | Third-party dependencies | Identify known vulnerable packages and license risk |
| Secret scanning | Repository and build artifacts | Detect exposed credentials or private keys |
| DAST | Running application behavior | Test server responses through requests |
| Manual testing | Context and business logic | Find workflow and authorization weaknesses |
| Configuration review | Runtime and infrastructure settings | Check headers, TLS, storage and access policies |
Automated scanners increase coverage, but they cannot fully understand business rules or decide whether one user should access another user's object.
A Practical Testing Process
1. Understand the Application
Document:
- important assets and sensitive data
- user roles
- authentication flows
- privileged operations
- APIs and data stores
- external services
- deployment boundaries
2. Build an Attack-Surface Inventory
List externally reachable behavior:
- pages and forms
- API endpoints
- file uploads and downloads
- WebSocket connections
- callbacks and webhooks
- mobile or desktop clients
- administration interfaces
Old, undocumented or unused endpoints still need protection if they remain reachable.
3. Create Test Identities
Use controlled accounts representing relevant roles:
anonymous user
regular user A
regular user B
support role
administrator
Two same-role accounts are especially useful for checking whether one user can access another user's data.
4. Observe Normal Behavior
Record the intended workflow first:
- request method and URL
- headers and cookies
- request body
- response status and body
- redirects
- follow-up requests
- resulting application state
This becomes the baseline for controlled security tests.
5. Change One Condition
Form a specific hypothesis and change one variable at a time.
Hypothesis:
The server may trust the account ID supplied by the browser.
Controlled test:
Use authorized test account A and replace only the object ID
with the object belonging to authorized test account B.
Changing one condition makes the result easier to interpret.
6. Validate the Result
Confirm that the behavior is:
- reproducible
- caused by the tested condition
- not an expected public operation
- not only a client-side display issue
- meaningful to confidentiality, integrity or availability
Do not collect more sensitive data than needed to prove the issue.
7. Report and Retest
Provide evidence, impact and remediation guidance. After a fix, repeat the original steps and nearby cases to confirm the vulnerability is removed without breaking intended behavior.
Intercepting HTTP Traffic
An intercepting proxy sits between a test browser and the target application.
Without a proxy
Browser --------------------> Server
With an intercepting proxy
Browser -> Testing Proxy -> Server
The proxy can show requests and responses, pause a request, and send an edited version to the server.
This demonstrates why frontend controls are not sufficient: the request can be changed after the UI creates it.
Burp Suite Overview
Burp Suite is a security testing platform that includes an intercepting proxy and tools for controlled HTTP analysis.
Core areas from the source are:
- Proxy: observe or intercept browser traffic
- HTTP history: review captured requests and responses
- Repeater: resend one request with controlled modifications
- Intruder: automate bounded input variations in an authorized scope
Burp provides visibility and control. The tester still needs a hypothesis, permission, careful analysis and safe limits.
Safe HTTPS Interception
HTTPS normally prevents an intermediary from reading browser traffic. A testing proxy can inspect HTTPS only when the test browser trusts a certificate controlled by that proxy.
Prefer Burp's dedicated browser or a disposable browser profile because it isolates the test certificate from normal browsing.
If a certificate must be imported manually:
- use only a controlled test machine or profile
- obtain it from the running local proxy
- never install an unverified certificate
- protect the proxy's private certificate material
- remove the trust configuration after testing
- do not intercept unrelated personal or production traffic
Installing a testing certificate into an operating system's global trusted-root store expands trust for every application that uses that store. Avoid that broad change unless the controlled environment and test requirement make it necessary.
Proxy and HTTP History
Intercepting a Request
When interception is enabled, the proxy can pause a request before forwarding it.
The tester can inspect:
- method and path
- query parameters
- headers
- cookies
- content type
- body fields
For an authorized test, a request can be changed to verify server-side controls.
Examples include:
- removing an optional field
- changing a controlled test record identifier
- omitting authentication
- changing an expected content type
- repeating a state-changing request safely in test data
HTTP History
HTTP history provides a map of observed application communication.
Use it to understand:
- API structure
- authentication and refresh flows
- redirects
- sensitive operations
- background requests
- differences between user roles
Filter noise and label important requests before deeper testing.
Do not assume an endpoint is vulnerable merely because it is absent from the visible UI. Verify the intended access policy.
Repeater: Controlled Hypothesis Testing
Repeater takes one captured request and allows it to be sent repeatedly with deliberate changes.
Capture a baseline request
|
v
Send it to Repeater
|
v
Change one authorized test value
|
v
Send and compare the response
Useful defensive questions include:
- Does the server reject a missing or invalid session?
- Does changing an object ID expose another test account's data?
- Does the server validate the body independently of the UI?
- Is a state-changing action protected from replay or duplication?
- Does a lower-privileged role receive a consistent denial?
Change only the evidence required to answer the question. Avoid destructive actions and real sensitive records.
Intruder: Bounded Automation
Intruder automates controlled variations at marked positions in a request.
Use automation only within the approved rate, data and endpoint scope. Begin with a very small payload set and confirm that the target environment can safely handle it.
Sniper
Changes one selected position at a time using values from one payload list.
Useful for isolating the behavior of one field.
Battering Ram
Places the same value into several selected positions at the same time.
Useful only when the fields are intentionally expected to share a value.
Pitchfork
Uses several payload lists in parallel, matching values by position.
Useful for related test cases prepared as pairs or tuples.
Cluster Bomb
Tests combinations across several payload lists.
The request count grows quickly, so this mode can cause accidental load, lockouts or cost. Use it only when explicitly authorized and necessary, with strict request limits.
Automated input variation is not a substitute for rate-limit, load or resilience testing. Each activity needs its own scope and safety plan.
Analyzing Results
Status codes alone are not enough.
Compare:
- response status
- response body and structure
- content length
- headers and cookies
- redirects
- response timing
- resulting server state
- audit events
Same status, different body
-> possible authorization or validation difference
Same body, different timing
-> possible different backend path; investigate carefully
Consistent denial and unchanged state
-> control may be working as intended
Differences are clues, not proof. Timing can vary because of caching, network noise or background work. Reproduce the behavior and correlate it with server evidence where possible.
Authentication Testing
Authentication establishes who the caller is.
Verify behavior for:
- missing credentials
- invalid or expired sessions
- logout and session revocation
- password-reset flows
- multi-factor recovery
- account lockout or throttling
- session rotation after sign-in or privilege change
- token audience, issuer and expiry validation
Expected behavior should be consistent and should not reveal whether a sensitive account exists unless that disclosure is intentional.
Do not perform password guessing against real accounts. Authentication-rate tests require dedicated accounts, explicit permission and lockout safeguards.
Authorization Testing
Authorization determines what an authenticated caller may do.
Horizontal Access Control
Check whether one regular user can access another regular user's objects.
User A owns object A
User B owns object B
Request as user A for object B
Expected: deny unless sharing is explicitly allowed
Vertical Access Control
Check whether a lower-privileged role can perform an administrator or staff action.
Function and Object Authorization
Test both:
- permission to call the operation
- permission to access the specific object
A route protected for signed-in users can still be vulnerable if it does not verify ownership or role for each object.
Build an authorization matrix:
| Operation | Anonymous | User A | User B | Admin |
|---|---|---|---|---|
| Read public item | Allow | Allow | Allow | Allow |
| Read user A profile | Deny | Allow | Deny | Policy dependent |
| Update user A profile | Deny | Allow | Deny | Policy dependent |
| Delete any user | Deny | Deny | Deny | Allow |
Convert important matrix rules into automated integration tests.
Input and Output Testing
Server-Side Validation
Test:
- missing required fields
- unexpected fields
- wrong types
- values outside allowed ranges
- excessively large input within safe test limits
- duplicate or replayed submissions
- alternate content types
- canonicalization differences
The server should reject invalid input predictably without exposing internal implementation details.
Injection Risks
Injection occurs when untrusted input changes the meaning of a command or query interpreted by another system.
Defenses include:
- parameterized queries
- structured APIs instead of command construction
- allowlist validation where suitable
- least-privileged service accounts
- safe escaping for the destination context
Security tests should verify these controls in an authorized test environment without targeting unrelated systems or extracting unnecessary data.
Cross-Site Scripting
Verify that untrusted content cannot execute as script when rendered.
Use context-appropriate output encoding, safe DOM APIs and framework protections. Treat sanitization as a specialized control for features that intentionally accept markup.
File Uploads
Test file type, size, naming, storage location, authorization and downstream processing.
Uploaded files should not become executable application code or bypass access rules merely because the browser supplied a trusted-looking filename or content type.
Session, Cookie and Request Security
Review whether session cookies use suitable attributes such as:
SecureHttpOnly- an appropriate
SameSitepolicy - a limited path and domain
Also verify:
- session identifiers rotate when required
- logout invalidates the server-side session where applicable
- sensitive actions have cross-site request protections
- CORS permits only intended origins and methods
- credentials are not placed in URLs
- sensitive responses prevent inappropriate caching
Cookie attributes support security but do not replace server-side authentication and authorization.
Business-Logic Testing
Business-logic vulnerabilities violate product rules even when individual requests are syntactically valid.
Examples to test safely include:
- applying a one-time benefit more than once
- skipping a required workflow step
- changing price or quantity fields controlled by the server
- replaying a confirmed operation
- creating inconsistent state through concurrent requests
- exceeding account or transaction limits
These issues often require understanding the complete workflow rather than running a generic scanner.
Security Headers and Error Handling
Review applicable controls such as:
- Content Security Policy
- clickjacking protections
- MIME-sniffing protection
- transport security policy
- referrer policy
- cache directives for sensitive responses
Error responses should:
- use stable public error codes
- avoid stack traces and database details
- avoid reflecting secrets
- preserve useful internal logs with restricted access
- use consistent authorization denials where information disclosure matters
Headers are defense-in-depth. They cannot fix missing authorization or unsafe backend logic.
Automation in the Delivery Pipeline
Use several layers rather than one security gate:
Code change
-> secret scanning and dependency checks
-> static analysis
-> unit and integration security tests
-> build and configuration checks
-> controlled dynamic scan
-> manual review for high-risk flows
-> production monitoring
Automate stable rules such as:
- users cannot read another user's object
- expired sessions are rejected
- privileged endpoints require the correct role
- sensitive cookies use required attributes
- invalid request shapes are rejected
Treat scanner findings as leads that need validation. Define how false positives, accepted risks and remediation deadlines are tracked.
Reporting a Finding
A useful report includes:
- concise title
- affected component and environment
- required role or precondition
- exact authorized reproduction steps
- expected and observed behavior
- minimal evidence
- security impact
- severity rationale
- recommended remediation direction
- retest result
Describe Impact Clearly
Connect the technical behavior to an asset or business outcome.
Weak description:
The server returned 200.
Useful description:
A regular test user can retrieve another test user's private profile
by changing the object ID because ownership is not checked.
Severity should consider exploitability and impact, including required access, affected data, scale and available safeguards.
Handle Evidence Safely
- redact tokens and credentials
- use test data
- store reports in approved systems
- restrict access
- avoid copying full sensitive records
- follow retention rules
Retesting and Regression Protection
After remediation:
- repeat the original request and confirm the issue is fixed
- test nearby roles, objects and alternate request forms
- confirm intended users still succeed
- add an automated regression test where practical
- verify logging and alerting behavior if relevant
A changed status code alone does not prove the vulnerability is fixed. Confirm that unauthorized data or state change is no longer possible.
Common Mistakes
| Mistake | Better approach |
|---|---|
| Testing without explicit authorization | Define written scope, limits and contacts first |
| Trusting browser validation | Enforce validation and authorization on the server |
| Installing a proxy CA globally without need | Prefer an isolated testing browser or profile |
| Changing many request fields at once | Change one condition and compare with a baseline |
| Looking only at status codes | Compare body, headers, timing and resulting state |
| Treating every response difference as a vulnerability | Reproduce it and connect it to security impact |
| Automating large payload sets immediately | Start small and respect approved rate and safety limits |
| Testing only unauthenticated endpoints | Test role and object authorization with controlled accounts |
| Reporting raw scanner output | Validate findings and explain the real impact |
| Collecting excessive sensitive data as proof | Use the minimum evidence required |
| Fixing only one visible endpoint | Check the shared control and nearby operations |
| Skipping retesting | Repeat the original case and add regression coverage |
Summary
Security testing verifies that application controls continue to work when a client changes requests or crosses trust boundaries.
Obtain authorization and define safe scope
|
v
Map assets, roles, endpoints and trust boundaries
|
v
Capture a valid baseline request
|
v
Change one controlled condition
|
v
Compare responses and resulting state
|
v
Validate impact with minimal evidence
|
v
Report, remediate and retest
Strong security testing combines careful HTTP observation, server-side control checks, safe automation, business context and disciplined reporting. Tools provide visibility; reliable conclusions come from clear hypotheses, authorization and reproducible evidence.