Բոլոր դասերը
ԱնվտանգությունՄիջին12 րոպե ընթերցումԱրժե իմանալ

Penetration testing basics

How authorised security testing works: scope, methodology, tools and a report people can act on.

  • Recon
  • OWASP ZAP
  • Burp
  • Reporting
  • Ethics
Քայլ 1/5
Մուտքի ձև։ Անվան փոխարեն հաքերը գրում է ' OR 1=1 -- ու ժպտում արևային ակնոցի տակից։

30 վայրկյանում

A penetration test is an authorised, simulated attack on a system to find weaknesses before real attackers do. It follows a method: agree the scope in writing, map the target, look for vulnerabilities, carefully prove the important ones, and write a clear report. The legal rule comes first: you only test systems you own or have explicit written permission to test.

Իմ ամենօրյա stack-ում չէ․ գիտեմ հիմնական գաղափարները և մանրամասները կսովորեմ, երբ նախագիծը դա պահանջի։

Ինչու է սա կարևոր

  • Automated scanners find known patterns; a tester finds broken business logic, chained weaknesses and access-control gaps that tools miss.
  • Many regulations, payment schemes and enterprise customers expect regular independent testing, so teams need to understand how a test is scoped and what the report means.
  • Developers who understand an attacker's method write safer code, review more sharply and fix findings faster.
  • A good test turns vague fear ('are we secure?') into a prioritised, evidence-based list of fixes.

Ինչպես է աշխատում

01Authorisation first: the legal and ethical line

The difference between a penetration tester and a criminal is permission. Accessing a computer system without authorisation is a crime in most countries, including under laws like the UK Computer Misuse Act and the US Computer Fraud and Abuse Act, even if you 'only looked' and meant well. Before any testing, a professional gets a signed authorisation from someone who actually owns the systems, plus agreed rules of engagement. Cloud and SaaS platforms add a second layer: your contract with the provider. Most major clouds allow customers to test their own resources within published policies, but forbid things like denial-of-service tests or touching shared infrastructure. Bug bounty programmes are a form of permission too, but only for the assets and techniques they list. If something is out of scope, it stays untouched, even when it looks vulnerable.

  • Only test what you own or are explicitly authorised in writing to test.
  • Respect scope, time windows and banned techniques exactly.
  • Stop and report immediately if you touch real personal data or find signs of a real breach.
  • Practise on deliberately vulnerable labs, never on random sites.

02Types of tests and what they answer

Tests differ by target and by how much the tester knows. A black-box test starts with almost no information, like an outside attacker. A grey-box test gives the tester normal user accounts and some documentation, which is the most efficient choice for web apps because time goes into real flaws instead of guessing. A white-box test includes source code and architecture, combining review with testing. Targets vary too: external network, internal network, web application, API, mobile app, cloud configuration, or people (phishing and social engineering, which needs extra legal and HR care). A red-team exercise is different again: a longer, goal-driven simulation that also tests whether the defenders notice. Pick the type that matches the question the business is asking, not the most dramatic one.

  • Vulnerability scan: automated, broad, shallow; finds known issues.
  • Penetration test: time-boxed, human-led, proves real impact within scope.
  • Red team: goal-based, stealthy, tests detection and response as well.

03The methodology: from scope to report

Good testers follow a repeatable method so nothing important is skipped. The Penetration Testing Execution Standard (PTES) describes seven phases, and the OWASP Web Security Testing Guide (WSTG) gives a detailed checklist for web applications. In practice: pre-engagement (scope, permissions, contacts, emergency stop procedure), reconnaissance (what exists: hosts, subdomains, endpoints, technologies), threat modelling (what would hurt this business most), vulnerability analysis (manual testing plus tools), careful exploitation to confirm real impact, post-exploitation only as far as the rules allow, and reporting. Throughout, the tester keeps detailed notes and timestamps, so every finding can be reproduced and every action can be explained if something unexpected happens on the target.

  • Pre-engagement, intelligence gathering, threat modelling, vulnerability analysis.
  • Exploitation, post-exploitation, reporting (the seven PTES phases).
  • Use the WSTG and OWASP Top 10 as coverage checklists for web apps.

04Tools of the trade

Tools support judgement; they do not replace it. An intercepting proxy sits between your browser and the application so you can see and modify every request: Burp Suite (Community and Professional editions) and ZAP (the open-source proxy and scanner formerly known as OWASP ZAP) are the standards. Nmap maps open ports and services on hosts you are allowed to scan. Browser developer tools reveal API calls, tokens and client-side logic. Dependency and container scanners find known vulnerable components. For practice, use intentionally vulnerable targets such as OWASP Juice Shop or DVWA running locally. The example below starts Juice Shop on your own machine, giving you a legal lab to learn the proxy workflow on.

bash
# A legal practice target, running only on your own machine
docker run --rm -p 127.0.0.1:3000:3000 bkimminich/juice-shop
 
# Discover services on a host you own (here: your own lab VM)
nmap -sV -Pn 192.168.56.10
 
# Baseline passive scan with ZAP against your local lab app
docker run --rm --network host -t zaproxy/zap-stable \
  zap-baseline.py -t http://127.0.0.1:3000

05Where real findings come from

Most serious web findings are not exotic. They are broken access control (user A can read user B's order by changing an ID), weak authentication flows (password reset tokens that never expire), missing rate limits, injection where input reaches a query or command unsafely, insecure direct file access, exposed admin panels, secrets in front-end bundles, and misconfigured cloud storage. Business-logic flaws are the tester's speciality: applying a discount twice, paying in one currency and refunding in another, skipping a step in a checkout flow. These require understanding what the application is supposed to do, which is why grey-box testing with real accounts and a short product walkthrough is so productive. Confirm impact with the smallest safe proof, such as reading your own second test account's data, not a real customer's.

06Writing a report people can act on

The report is the product. Executives need a one-page summary: overall risk, the few issues that matter most, and what to do next. Engineers need each finding with a title, severity, affected component, clear reproduction steps, evidence (requests, responses, screenshots with sensitive data masked), impact in business terms and a specific fix. Rate severity consistently, for example with CVSS plus a note on business context, because a medium technical issue on a payment flow can matter more than a high one on a test server. Include what was in scope, what was not, and what was not tested due to time. Offer a retest: a finding is only closed when someone has verified the fix.

  • Executive summary, scope and method, findings, appendices.
  • Each finding: severity, steps, evidence, impact, remediation, references.
  • Mask any personal data and secrets in evidence.

Օգտագործեք, երբ

  • Before launching a product that handles payments, personal data or admin powers.
  • After major changes to authentication, authorisation or infrastructure.
  • When a customer, regulator or payment scheme requires independent testing.
  • Periodically (often yearly) for systems with real exposure and value.

Մի՛ օգտագործեք, երբ

  • As a substitute for basic hygiene: patching, secure defaults and code review come first.
  • On any system you do not own or lack written permission to test, including third-party APIs you merely use.
  • When the system is not stable yet; test once the feature set is close to final, then retest.

Այլընտրանքներ

  • Automated scanning (DAST/SAST/SCA)

    Cheap, continuous coverage for known patterns and vulnerable dependencies; misses logic flaws.

  • Bug bounty programme

    Many testers, pay per valid finding; needs mature triage and a clear scope.

  • Secure code review

    Finds root causes in source; pairs well with grey-box testing.

  • Red team exercise

    Goal-driven and stealthy; tests detection and response, not just vulnerabilities.

Լավագույն պրակտիկաներ

  1. Get written authorisation from the real system owner and confirm scope, windows and emergency contacts.
  2. Prefer grey-box tests with test accounts for each role; they find more in the same time.
  3. Use test environments that mirror production, and agree how production may be touched, if at all.
  4. Keep timestamped notes of every action so findings are reproducible and incidents are explainable.
  5. Prove impact with the minimum safe action, using your own test data.
  6. Write fixes that address root causes (central authorisation checks), not just the single endpoint.
  7. Retest every high and critical finding and track remediation to closure.

Տարածված սխալներ

  • Testing without written permission, or drifting outside the agreed scope.
  • Pasting raw scanner output as a 'report' without verification or business context.
  • Running aggressive scans against production during peak hours without agreement.
  • Treating a clean report as proof of security rather than a snapshot in time.
  • Fixing only the reported URL while the same pattern exists across the codebase.

Խորը վերլուծություն

07Access control testing at scale

Broken access control is the most common serious web finding, and it is systematic, not random. The efficient approach is a matrix: list every endpoint (from the proxy history or an OpenAPI file) against every role and tenant, then replay each request with the wrong identity. Proxy extensions can automatically resend each request with a lower-privilege session and flag responses that look the same. Check horizontal access (user A to user B), vertical access (user to admin), and multi-tenant isolation (company A to company B). Also check indirect paths: exports, file downloads, websockets, GraphQL fields, background job results and webhooks. In the report, point at the missing central check rather than listing fifty endpoints, because the fix belongs in shared middleware or a query scope.

08APIs, mobile apps and modern front ends

Single-page apps and mobile apps move logic to the client, but the server must still enforce every rule. Testers read the API traffic, not the UI: hidden fields, admin-only properties accepted on update (mass assignment), predictable IDs, excessive data in responses that the UI simply does not display. For mobile, testers inspect traffic through a proxy on a test device, check certificate validation and look for secrets or API keys in the app bundle. Token handling matters: where tokens are stored, how long they live, whether refresh tokens rotate and whether logout actually revokes anything. The OWASP API Security Top 10 and the mobile testing guide (MASTG) extend the web checklist for these targets.

09Testing safely in shared and production environments

Real systems have real users. Rate-limit your own tools, avoid destructive actions (deleting records, sending mass emails, triggering payments) unless the rules explicitly allow them in a sandbox, and use payment provider test modes. Watch for side effects: a form fuzzed with thousands of inputs may send thousands of notifications. When testing cloud configurations, read-only audit roles are often enough to find misconfigured storage, overly broad IAM policies or exposed snapshots without touching data. Keep an emergency channel open with the system owner during the test window, and stop immediately if the service degrades.

10From findings to a better development process

A mature team uses each report to remove whole classes of bugs. Group findings by root cause: missing authorisation middleware, unsafe query building, inconsistent input validation, secrets management. For each class, add a durable control: a framework-level default, a lint rule, a test helper that checks the 'wrong user' case for every endpoint, or a CI scanner. Track time-to-fix by severity as a metric. Feed recurring patterns into code review checklists and onboarding. Over a few cycles, pentest reports should shift from basic access-control bugs to subtle logic issues, which is a sign the process is working.

Իրական իրավիճակներ

01

First pentest before an e-commerce launch

Խնդիր

A shop with customer accounts, saved addresses and an admin panel launches in six weeks. Management asks for 'a pentest' but has no idea what to request or how to prepare.

Ինչպես լուծել

Define the question first: can an outsider or a normal customer reach other customers' data, admin functions or money? Request a grey-box web and API test of the storefront, account area, checkout and admin panel on staging, with accounts for guest, customer and each admin role. Exclude denial of service and social engineering. Provide the API specification and payment sandbox credentials. Schedule the test about four weeks before launch, leaving two weeks for fixes and a retest of high and critical findings. Ask for an executive summary plus per-finding reproduction steps and remediation.

02

A researcher reports a bug on a system you did not authorise them to test

Խնդիր

An unknown person emails the team saying they found an IDOR in the API and asks for a reward. There is no bug bounty programme and no published disclosure policy.

Ինչպես լուծել

Respond politely, thank them, and ask for details through a secure channel. Verify and fix the issue quickly; the bug is real regardless of how it was found. Do not promise rewards you have no policy for, and do not threaten unless there is clear malicious activity; check logs to see whether any data was accessed beyond proof. Afterwards, publish a security.txt file and a vulnerability disclosure policy that explains how to report, what is in scope and what safe-harbour terms apply, so future reports arrive in a controlled way.

03

The report has 60 findings and the team is overwhelmed

Խնդիր

A pentest returns 60 findings across severity levels. Developers argue about scores and nothing gets fixed for weeks.

Ինչպես լուծել

Triage in one meeting with the security owner and tech lead. Group findings by root cause; often 60 findings collapse into eight patterns, such as a missing authorisation middleware or missing security headers. Fix critical and high issues first, with owners and dates. For each pattern, choose a central fix plus a regression test. Accept or schedule low-risk items explicitly, with a written reason. Ask the tester to retest the fixed items. Report progress as patterns closed, not just tickets closed.

Արագ ուղեցույց

Run a legal local practice target
docker run --rm -p 127.0.0.1:3000:3000 bkimminich/juice-shop
Service discovery on your own lab host
nmap -sV -Pn 192.168.56.10
ZAP baseline (passive) scan of your app
docker run --rm -t zaproxy/zap-stable zap-baseline.py -t https://staging.example.com
Publish a disclosure contact
/.well-known/security.txt with Contact: mailto:[email protected] and Expires:
Web test coverage checklist
OWASP Web Security Testing Guide (WSTG) + OWASP Top 10
API test checklist
OWASP API Security Top 10
Mobile test checklist
OWASP MASVS (requirements) + MASTG (testing guide)
Severity scoring
CVSS base score + written business-context note
Methodology phases
Pre-engagement, recon, threat model, vuln analysis, exploitation, post-exploitation, report

Հարցեր և պատասխաններ

Q1What is the difference between a vulnerability scan and a penetration test?

A vulnerability scan is automated: a tool checks many targets for known issues, such as outdated software or missing headers, and produces a long list that may include false positives. A penetration test is human-led and time-boxed. The tester uses tools, but also understands the application, chains small issues together, tests business logic and access control, and proves real impact safely. The scan answers 'what known problems might exist?'. The pentest answers 'what could an attacker actually achieve here, and how bad would it be?'. Teams usually need both: continuous scanning for hygiene and periodic pentests for depth.

Q2What must be agreed before a test starts?

Written authorisation from someone with real authority over the systems, and rules of engagement. Those cover the exact scope (domains, IP ranges, apps, API versions), what is excluded, testing windows, allowed and forbidden techniques (for example no denial of service, no social engineering), test accounts per role, how production data is handled, and emergency contacts with a stop procedure if something breaks. If cloud or third-party services are involved, check their testing policies too. Finally, agree the deliverable: report format, severity scheme, timeline and whether a retest is included. Clear pre-engagement prevents both legal risk and wasted time.

Q3Black-box, grey-box or white-box: which would you recommend?

For most web and API tests I would recommend grey-box: give the tester accounts for each role and basic documentation. A black-box test spends a lot of paid time rediscovering what you could have told the tester, and it still tests only from the outside. White-box adds source code access, which is excellent for finding root causes and for complex authorisation logic, but takes more time and skill. Black-box is useful when the specific question is 'what can an anonymous outsider see and do?', for example for an external attack-surface review. Match the type to the question.

Q4How do you rate the severity of a finding?

Start with a consistent technical score, commonly CVSS, which considers how the issue is exploited (network or local, complexity, privileges, user interaction) and its impact on confidentiality, integrity and availability. Then adjust the narrative for business context: which data or money is exposed, how many users, whether it is internet-facing, and whether there are compensating controls. A reflected XSS on an unused marketing page and the same bug in the admin panel have similar scores but very different real risk. The report should explain the reasoning, so the team can prioritise fixes with confidence instead of arguing about numbers.

Q5What would you do if you found real customer data during a test?

Stop exploring that path immediately and access no more than needed to confirm the issue. Do not download, copy or keep the data beyond what the rules allow; mask it in any evidence. Notify the agreed contact quickly, because exposure of personal data may itself be a reportable incident for the client, with legal deadlines. Record exactly what you accessed and when. Then continue with the agreed plan, usually documenting the finding with minimal evidence. Handling this moment calmly and transparently is part of professional ethics and protects both the tester and the client.

Q6How should developers prepare for a pentest?

Freeze the scope to a stable build, ideally in a staging environment that mirrors production configuration. Create test accounts for every role and tenant, seed realistic but fake data, and share API documentation or an OpenAPI file. Make sure logs and monitoring are on so you can see what the tester did. Tell the operations team the dates so alerts are not escalated as a real attack, or deliberately not, if detection is part of the test. Fix known issues first; paying testers to find what you already know wastes the budget. Plan time after the report for fixes and a retest.

Սենիոր մակարդակի հարցեր

S1How would you design a security testing programme for a growing SaaS product?

Layer it by cost and depth. Continuous, cheap controls run on every change: dependency scanning, secret scanning, static analysis and a passive DAST baseline in CI. Developers own a 'wrong user, wrong tenant' test for each endpoint so access control is verified automatically. Periodic human testing comes next: a grey-box pentest yearly and after major changes to auth, billing or tenancy, scoped by a threat model rather than by 'test everything'. Later, add a disclosure policy, then possibly a private bug bounty once triage capacity exists. Measure outcomes: time-to-fix per severity, recurrence of finding classes, and coverage of critical flows. The trade-off is budget versus depth; spending on automated basics first makes expensive human time count.

S2Pentest versus bug bounty: when does each make sense?

A pentest buys guaranteed coverage of a defined scope in a fixed window, with a methodology and a report, which suits compliance, pre-launch checks and systems with complex roles. Its limit is time: a few days of a few people. A bug bounty buys many perspectives over a long period and you pay per valid finding, so it can be cost-effective for broad, internet-facing surfaces. Its costs are hidden: triage effort, duplicate and low-quality reports, and the need for a mature process to fix and pay quickly. Bounties also give weak guarantees about coverage. Most teams should start with pentests and a disclosure policy, then add a private bounty when they can handle the volume.

S3How do you scope a test for a multi-tenant platform?

The primary risk in multi-tenancy is one customer seeing or changing another's data, so the scope must make that testable. Provide at least two tenants, each with every role, and seed recognisable fake data so leaks are obvious. Include every channel that touches tenant data: web, mobile API, admin, exports, websockets, webhooks, background job results and file storage. Ask testers to focus on identifier manipulation, tenant headers or subdomains, cached responses and search indexes. Agree whether the shared control plane (billing, provisioning) is in scope. Exclude load testing on shared infrastructure. In the findings review, look for the systemic fix, such as a mandatory tenant scope in the data layer, instead of patching endpoints one by one.

Բառարան

Scope
The exact systems, addresses and techniques a tester is permitted to use. Anything outside it is off limits.
Rules of engagement
The agreed conditions of a test: time windows, allowed methods, contacts and how to stop if something breaks.
Reconnaissance
Mapping what exists: hosts, subdomains, endpoints, technologies and exposed services, before looking for weaknesses.
IDOR
Insecure direct object reference: changing an ID in a request returns another user's data because the server skips the ownership check.
Intercepting proxy
A tool such as Burp Suite or ZAP that sits between browser and server so you can inspect and modify requests.
CVSS
Common Vulnerability Scoring System: a standard 0-10 score describing how exploitable and damaging a vulnerability is.
False positive
A tool reports a vulnerability that does not actually exist. Manual verification filters these out.
Retest
A follow-up check that confirms a reported vulnerability has really been fixed.
Responsible disclosure
Reporting a vulnerability privately to the owner and giving them time to fix it before any public discussion.

Պրոդուկտի գաղափար ունե՞ք։Եկեք ստեղծենք այն։

Պատմեք ձեր գաղափարի, պրոդուկտի կամ թիմի մասին։ Սովորաբար պատասխանում եմ մեկ աշխատանքային օրվա ընթացքում։