Skip to content
Tutorials Center
My learning

Topics

Lesson 43 of 60 ยท Non-functional Testing Concepts

Security Testing Basics

Learn the basics of security testing: OWASP Top 10 themes, injection, broken authentication, XSS, input checks and responsible testing, with runnable probes.

Most bugs make a product annoying. Security bugs make it dangerous: leaked customer data, stolen accounts, money moved by someone else. Security testing looks for weaknesses that an attacker could use, and as a tester you do not need to be a penetration specialist to contribute. A surprising number of real breaches start with ordinary mistakes, such as a form field that trusts what it is given.

This lesson covers the common categories of weakness, how to think like an attacker while staying on the right side of the law, and a few basic checks you can run by hand. The code is a stand-in: tiny functions that show why injection and cross-site scripting happen and how a probe finds them. No real site is touched, and you should never aim these ideas at systems you do not have written permission to test. Security is one of the non-functional test types.

The security mindset

Functional testing asks "does it do what it should?" Security testing also asks "can it be made to do what it should not?" You think about three things:

  • Assets: what is worth protecting (accounts, personal data, payments, admin functions).
  • Threats: who might attack and why (a curious user, a criminal, a disgruntled insider).
  • Entry points: everywhere data or commands come in (forms, URLs, headers, file uploads, APIs, third-party integrations).

Spend your effort where assets and entry points meet. This is risk-based testing applied to security: login, payment and anything that exposes personal data deserve the most attention.

A classic summary of aims is the CIA triad: Confidentiality (only the right people see data), Integrity (data is not altered improperly) and Availability (the system stays usable).

Common weakness themes

The OWASP project publishes a regularly updated list of the most serious web application risks, often called the OWASP Top 10. The exact ranking changes between editions, but the themes stay familiar. Here are the ones every tester should recognize.

Weaknesses to know

Injection Input is run as a command.
Broken authentication Weak logins and sessions.
Broken access control Users reach what is not theirs.
XSS Script injected into a page.

Each starts with data the system trusted too much.

1 / 2
  • Injection: untrusted input is interpreted as part of a command, such as SQL, a shell command or a template. Classic example: a login form where typing ' OR '1'='1 changes the meaning of the database query.
  • Broken authentication: weak passwords allowed, no limit on guesses, sessions that never expire, "forgot password" flows that leak information.
  • Broken access control: a normal user changes /orders/1001 to /orders/1002 and sees someone else's order, or opens an admin URL directly.
  • Cross-site scripting (XSS): a page displays user-supplied text without escaping it, so a script typed into a comment box runs in other users' browsers.
  • Security misconfiguration: default passwords, verbose error pages that reveal internals, publicly readable file storage.
  • Vulnerable components: the application uses a library with a known, published flaw.

Input validation checks you can do by hand

Every input field is an entry point. Beyond the usual boundary and partition values, try inputs that attackers use, in a test environment you are allowed to use:

  • Very long strings, empty values, and unusual characters (quotes, angle brackets, semicolons, slashes).
  • Text that looks like markup, to see whether it is shown as text or interpreted. A harmless marker such as <b>x</b> is enough to tell whether output is escaped.
  • A single quote in a text field: an unexpected database error page is a warning sign for injection.
  • Repeated wrong passwords: is there a lockout or delay?
  • Changing identifiers in URLs and API calls to values you should not be allowed to see.
  • Logging out, then pressing the browser's Back button, or reusing an old session link.
  • Uploading a file with the wrong extension or an unexpectedly large size.

Notice that these are all experience-based techniques: error guessing aimed at security.

Try it: why escaping matters

Output escaping turns characters that have special meaning in HTML into harmless text. This stand-in contains a naive renderer that pastes user input straight into HTML and a safe one that escapes it. A probe sends several suspicious strings to both and reports which ones came out still containing live markup. This is how a tester decides whether a field is a candidate for cross-site scripting; a real test would look at the browser, not at a string.

JS Sanitizer probe

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The naive renderer fails every probe that contains angle brackets. The safe one passes them all because the dangerous characters become text. Real defenses are layered: escape output according to where it is placed (HTML, attribute, URL, script), validate input on the server, and add browser protections such as a content security policy. Escaping on output is the key habit; checking input alone is not enough.

Try it: how injection changes a query

Injection is easiest to understand by looking at the text that is built. This stand-in does not use a database at all. It builds the SQL string two ways for a login lookup and shows what the database would receive. The first joins user input into the text; the second keeps the SQL fixed and passes the value separately, which is the idea behind parameterized queries.

JS Concatenated versus parameterized query

Press Run (or Ctrl + Enter) to see the console output here.

No output.

In the unsafe version the third input rewrites the condition into one that is always true, so the query would match every user. Even the harmless name o'brien breaks the unsafe query, which is how a tester notices the problem long before an attacker does: a stray quote causing an error is a symptom. With the parameterized form, the text stays a value, never a command. Developers fix injection with parameterized queries; testers find it by probing inputs and watching responses.

Authentication and access checks

Some of the most valuable security tests need no special tools:

  • Passwords: is a weak password such as 123456 rejected? Are passwords ever shown in plain text or emailed back?
  • Guessing: after many failed logins, does the account lock or slow down? Do error messages avoid revealing whether the username exists?
  • Sessions: does logging out really end the session? Does a session expire after inactivity?
  • Access control: can user A open user B's data by editing an ID? Can a normal user call admin features? Test each role against each function; a small table of roles by functions makes gaps visible, like a decision table.
  • Transport: is the site served over HTTPS, and does it redirect plain HTTP?

Penetration testing, SAST, DAST and IAST

So far the lesson showed checks you can do by hand. Professional security testing is organised into a few named approaches, and their names appear in job ads, audits and tool lists.

Vulnerability scanning versus penetration testing

A vulnerability scan is automated: a tool probes a system for known weaknesses (outdated components, missing patches, misconfigurations) and produces a list. It is broad, cheap and repeatable, but it reports possibilities, including false positives.

A penetration test (pen test) is a controlled, authorised attack carried out by skilled people who try to exploit weaknesses to show real impact: can they read another customer's data, take over an account, reach the internal network? It is deeper, slower and costs more, and it proves what a scan only suggests.

Typical stages of a penetration test:

  1. Scope and rules of engagement: written permission, targets, allowed methods, time window, contacts. Never skip this step.
  2. Reconnaissance: gather information about the target (technologies, endpoints, exposed services).
  3. Scanning and enumeration: find open ports, versions, pages and parameters.
  4. Exploitation: attempt to use weaknesses, within the agreed limits.
  5. Post-exploitation: judge the impact (what data or systems an attacker could reach) and clean up.
  6. Reporting: findings with evidence, severity, and remediation advice.
  7. Retest: confirm the fixes.

Pen tests are categorised by how much the tester knows: black box (no inside knowledge, like an outside attacker), white box (full access to code and design) and grey box (partial knowledge, such as a normal user account). These are the same ideas as in Black-Box, White-Box and Grey-Box Testing. A red team exercise goes further and simulates a determined attacker against people, processes and technology.

SAST, DAST and IAST

Application security testing tools are grouped by when and how they look at the application:

Approach Full name Looks at Needs a running app? Finds Misses
SAST Static application security testing Source code, bytecode, configuration No Injection patterns, hard-coded secrets, unsafe functions, early in development Runtime and configuration issues; many false positives
DAST Dynamic application security testing The running application, from outside, by sending requests Yes Real, exploitable behaviour: injection, missing headers, authentication issues Code location of the bug; unreachable pages
IAST Interactive application security testing The running application, from inside, through an agent that watches code during tests Yes Precise findings with the vulnerable line and the request that triggered it Needs instrumentation; only code that tests exercise
SCA Software composition analysis Third-party libraries and their versions No Known vulnerable dependencies and licence risks Flaws in your own code

SAST is the security version of static testing; DAST is dynamic testing from the attacker's viewpoint. They complement each other, and teams run SAST and SCA on every commit and DAST on a test environment in the pipeline, with pen tests before major releases (the idea of "shift-left" security).

Typical tool names include SonarQube, Semgrep and CodeQL for SAST, OWASP ZAP and Burp Suite for DAST, and dependency scanners built into code hosting platforms. Tools and products change quickly.

Triage: scanners are noisy

Every tool report needs a person to decide: is it a real vulnerability, can it actually be reached, how bad is it, and is it already known? Record the decision so the next scan does not repeat the same noise.

JS A tiny SAST-style scanner

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The scanner finds patterns, not proof. A DAST tool would instead send real payloads at the running page and check the response; the two views together give a fuller picture.

Choosing and combining

  • During coding: SAST, SCA, secret scanning, peer review.
  • In the pipeline on test environments: DAST, API security tests, IAST if available.
  • Before big releases or after major change: a penetration test by independent specialists.
  • Always: authorisation first, a safe environment, and a plan to fix and retest. See the section "Testing responsibly" below.

Testing responsibly

Security testing can cause damage and break laws if done carelessly. Follow these rules:

  • Get written permission that states what you may test, when and from where. Testing without it can be illegal even if you mean well.
  • Use a test environment with test data wherever possible, never real customer data. See test data and environments.
  • Avoid destructive actions and denial-of-service style tests unless they were explicitly agreed.
  • Report privately and quickly. A found vulnerability is reported through the agreed channel, not posted publicly, and written up like any other bug report with clear steps and impact.
  • Stay in scope. If you stumble onto something outside the agreed scope, stop and report that too.

Specialized work (penetration testing, code scanning, dependency audits) uses dedicated tools and experienced people. As a manual tester your role is to cover the basics, ask "what if someone abused this?" in reviews, and escalate what looks suspicious.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. A user changes the order number in a URL and sees another customer's order. Which weakness is this?

    The system failed to check that the logged-in user is allowed to see that order. Checking authorization on every request prevents it.
  2. 2. What does output escaping do?

    Escaping stops user-supplied text from being run as HTML or script, which is the core defense against cross-site scripting.
  3. 3. Why does a parameterized query protect against SQL injection?

    Because the input is never merged into the command text, characters such as quotes cannot change the meaning of the query.
  4. 4. What must you have before running security tests against a system?

    Testing without authorization can be illegal. Permission, a defined scope and a test environment keep the work safe and lawful.
  5. 5. Typing a single quote into a search box produces a raw database error page. What does this suggest?

    An unexpected error caused by a special character shows the input is interpreted by something. It is a classic hint of injection and should be reported.

Summary

  • Security testing asks whether the system can be made to do what it should not, protecting confidentiality, integrity and availability.
  • Common themes: injection, broken authentication, broken access control, cross-site scripting, misconfiguration and vulnerable components.
  • Treat every input as an entry point; probe with long text, special characters and changed identifiers.
  • Escape output and use parameterized queries; these defenses make the dangerous characters plain data.
  • Test only with written permission, in a test environment, and report findings privately and clearly.

Next: Reliability, Recovery and Disaster Testing.