In this section

0.12 Vulnerability Research and Disclosure

Module 0

Introduction

The course ends where much security work begins: someone finds a bug in software they do not own, and has to turn that finding into a fix. Module 12, the capstone, does the whole loop on a supplied codebase with an assistant's help: find planted bugs, prove each one, fix it, and write a disclosure graded against a rubric.

This lesson lays the foundation on a service small enough to read in one glance: what makes a finding credible, how weaknesses are classified and scored, why a fix has to hold for every input and not only the proof, and what a report to a maintainer must and must not contain.

An assistant writes the proof, the fix and the report to a contract. The check tests the fix against nine ways out of the folder and grades the report, and two fixes that look reasonable are measured and fail. The procedure below is the whole lesson in one picture, and every later section fills in one of its steps.

Procedure: from a suspected bug to a published advisoryA suspected bugAuthorized to test it?noStop: get written scopeor read program rulesyesReproduce minimallyLeast harmful proof.Stop at the evidence.Does it reproduce?noRecord asunconfirmedyesClassifyCWE-22ScoreCVSS 4.0Justify every metric;state what you assumed.Fix, and test inputsthe proof never usedResolve, then judge.No prefix, no blocklist.Report privatelysecurity.txt (RFC 9116)or the program's channel.Maintainer responds?noOther contacts, thena coordinator (CERT)deadline passesyesFix ships; CNA assigns CVEPublish what users needstepdecisionnotestops or fails

Coordinated disclosure as a procedure: authorization first, a minimal proof, classification and scoring in parallel, a fix tested beyond the proof, a private report, and publication once a fix exists or a deadline passes.

Read the decisions as much as the steps: the procedure stops twice before any report is written, once without authorization and once when the bug does not reproduce, and it reaches publication by two routes, a shipped fix or a deadline that passed while the maintainer stayed silent.

1

The Bug

Ten lines and a request parameter

Vulnerability research starts with a question about data flow: where does input the caller controls enter the program, and where does it end up being used for something that matters? The entry point is called a source and the place it is used is called a sink.

Most bugs worth reporting are a path from a source to a sink with nothing in between that limits what the input can do. In this service the source is the report name from the request URL and the sink is the call that opens a file. Here is the whole service, short enough to trace that path by eye.

Visual Studio Codeservice.py - sec410-lab
service.py
lab › foundations › reportsvc › service.py
1"""The report service. read_report(name) returns the text of a report in the reports folder. Called by the web layer with2the name from the request URL: GET /reports/<name>."""3import os45BASE = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'reports')678def read_report(name):9    with open(os.path.join(BASE, name)) as f:10        return f.read()
mainPythonUTF-8Ln 1, Col 1
reportsvc 1.4.2: the whole service, ten lines.

The function takes a name from the request URL, joins it to the reports folder and opens the result. Nothing checks that the result is still inside the folder. The system view shows where that trust sits: the name crosses from the caller through the web layer into the join without anything between them that limits it.

System: where reportsvc trusts its inputInternetreportsvc hostCallerGET /reports/<name>Attackercrafted <name>Web layerroutes the nameread_report()join(BASE, name)file systemreports/ (BASE, allowed)q3-2026.txtq2-2026.txtreports-internal/sibling folder, same prefixconfig.inidb_password123../config.iniabsolute path4intended pathattacker pathtrust boundary1request2name passed unchanged3joined and opened4the join resolves outside BASE

The name crosses from the caller into the file system with nothing between join and open: the intended path reaches reports/, and crafted names reach the sibling folder and config.ini.

The intended path ends in the reports folder. Every crafted name follows the same first two steps and diverges only at the join, which is why the fix belongs in the function that joins and opens, not in the layers in front of it.

A name containing two dots and a slash steps up to the parent directory, where the service keeps its configuration file with a database password in it. This is path traversal, one of the oldest web vulnerabilities and still a common one.

Whether a real request can carry those two dots all the way to the function depends on the layers in front of it. A web server or framework may normalize the URL path before routing it, and may reject or rewrite it. The same name can also arrive percent-encoded, or as an absolute path, or through a parameter rather than the path.

A researcher does not assume the front end protects the function, and a maintainer should not either: the function is where the file is opened, so the function is where the limit has to hold. That is why this lesson tests the function directly and why the report describes the request route as one way in, not the only one.

Classifying a finding is the first step to communicating it, because a class tells the maintainer what kind of mistake to look for and what fixes are known to work.

The Common Weakness Enumeration, CWE, maintained by MITRE, names this one CWE-22, Improper Limitation of a Pathname to a Restricted Directory, path traversal for short: the product builds a path from external input meant to stay under a restricted directory and does not neutralize elements, such as two dots, that resolve outside it.

A specific instance of a weakness in a specific product gets a CVE identifier when it is published, so that everyone discussing it means the same bug.

2

Authorization and Restraint

Prove it, then stop

The service was written for the lab, and testing it is authorized, as with every target in this module. Outside a lab, authorization is something you can point to before you start: a contract with a written scope, a bug bounty program's published rules, or software you run yourself on your own machine.

A program's rules usually say which hosts and versions are in scope, which techniques are not allowed, and how to report. Reading them first is part of the research, because a finding obtained outside the rules can be refused, and the testing that produced it may not be covered. The contract also sets a limit on the proof: read the configuration file and nothing more.

That limit is the habit that matters in real research. A proof of concept shows that a vulnerability exists, in the least harmful way that convinces a maintainer. It does not use the password it found, read every file it could, or keep copies. Going further turns a finding into an intrusion, and in many jurisdictions the difference is legal, not just ethical.

The contract asks for three things.

Visual Studio Codedisclosure.py - sec410-lab
disclosure.py
lab › foundations › disclosure.py
1"""Lesson 0.12: reproduce a bug, fix it, and report it. This file is the exercise: write poc(), safe_read_report() and2REPORT.34The target is lab/foundations/reportsvc, version 1.4.2: its read_report(name) serves files from a reports folder, with⋯ 10 lines folded15        resolve to a file inside the reports folder. Reports inside the folder still work.1617    REPORT18        The report you would send to the service's maintainers, as a dict with every key below filled in:19          title, product, affected_versions, cwe ('CWE-<n>'), summary, steps_to_reproduce, impact,⋯ 3 lines folded232425def poc():26    raise NotImplementedError('lesson 0.12: write poc')272829def safe_read_report(name):30    raise NotImplementedError('lesson 0.12: write safe_read_report')313233REPORT = {}
mainPythonUTF-8Ln 1, Col 1
The contract: reproduce, fix, report.

The fix must hold for any name, not just the proof's, and the report must be complete enough to act on and contain nothing the maintainers should not receive in an email. Run the check against the file as shipped.

$ python3 -m lab check f12
f12  0.12 Vulnerability Research and Disclosure: lab/foundations/disclosure.py
FAIL  the functions are written
      lesson 0.12: write poc
FAIL

The check runs the proof against the real service, tries nine names against the fix, from the obvious one to an absolute path and a sibling folder, and grades eleven sections of the report, including that the password does not appear in it.

The check grades what a script can grade: that the proof works, that the fix holds against a fixed set of attempts, and that the report has its sections and the right classification. It cannot tell whether the impact is overstated, whether the steps would make sense to someone who has never seen the lab, or whether the timeline is reasonable.

Those are judgments, and the review at the end of the session is where you make them. Nine refused attempts also do not prove a fix correct; they prove it survives the nine names someone thought to try, which is why the shortcuts later in the lesson are measured against the same list and why the list includes the names that defeated earlier fixes.

3

Session: The Brief

Restraint, generality, and the reader

The brief points at the contract and the service and sets three constraints in plain words.

SEC410 lab, lesson 0.122026-11-18
disclosure.pyPYservice.pyPY

Fill in disclosure.py to the contract in its docstring. reportsvc is a lab service written to be tested, and we are authorized to test it. Keep the proof of concept to reading config.ini and nothing more, write the fix so it holds for any name rather than the ones in the proof, and write the report for the maintainers: what they need to reproduce and fix it, without repeating the password it exposed.

disclosure.pyCode · PY · 59 linesDownload
Reply to Claude…Opus 5.5
Recorded unedited in assistant-records/m00/0.12-brief.md

Each constraint names a failure that is common in real reports. Proofs that do more than prove: a researcher who demonstrates a file read by downloading the whole database has created a breach to report a bug.

Fixes that only stop the proof: a filter for the exact string in the report, which the next tester walks around. And reports that leak what they describe: credentials pasted into a ticket that a dozen people can read. Writing the constraints into the brief keeps an assistant from optimizing for the check alone.

The brief also keeps the assistant's work inside the lab. An assistant asked to prove a bug will, if nothing stops it, reach for the most convincing evidence it can produce, and the most convincing evidence of a file read is reading more files.

Stating the limit in the brief, and then checking the draft against it, is the same discipline Module 0 has applied to every assistant output: the instruction narrows what it should do, and the check confirms what it did.

4

The Proof and the Fix

Resolve first, then judge

The reply was the whole file, so read it in two parts, starting with the proof of concept and the fixed function.

Visual Studio Codedisclosure.py - sec410-lab
disclosure.py
lab › foundations › disclosure.py
22import os2324from .reportsvc import service252627def poc():28    return '../config.ini'293031def safe_read_report(name):32    base = os.path.realpath(service.BASE)33    target = os.path.realpath(os.path.join(base, name))34    if os.path.commonpath([base, target]) != base or target == base or not os.path.isfile(target):35        raise ValueError(f'report {name!r} is not a file in the reports folder')36    with open(target) as f:37        return f.read()
mainPythonUTF-8Ln 1, Col 1
The draft: a one-line proof, and a fix that resolves the path before judging it.

The proof is one name. The fix resolves the requested path completely, following two-dot elements and symbolic links, before deciding anything, and then asks whether the resolved folder is the common root of the folder and the target.

Comparing resolved paths component by component is the reliable test; comparing strings is not, as section 6 measures. It also refuses the folder itself and anything that is not a regular file, so that a name like two dots on its own or an empty string cannot be used to probe the directory.

Two details in the fix are worth reading slowly. The folder itself is resolved too, so that the comparison is between two real paths rather than one real path and one that might pass through a symbolic link. And the order matters: resolve, then compare, then open. Checking the raw name and opening the resolved one would compare the wrong thing.

One limit remains that no path check removes: between the check and the open, something on the host could replace the file with a link. That race needs an attacker who can already write inside the folder, which is outside this service's threat model, but a review should name it rather than let the fix be described as complete.

Run the check against the draft.

$ cp records/disclosure-0.12.py lab/foundations/disclosure.py
$ python3 -m lab check f12
f12  0.12 Vulnerability Research and Disclosure: lab/foundations/disclosure.py
ok    poc() reproduces the bug against 1.4.2
      '../config.ini'
ok    the fixed function still serves real reports
ok    the fixed function refuses every way out of the folder
      9 of 9 refused
ok    the report has every section
      11 sections
ok    it names the product and version
ok    it classifies the weakness as path traversal
      CWE-22
ok    the CVSS vector is v4.0 with all eleven base metrics
      CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
ok    the steps contain the proof of concept
ok    the report does not repeat the leaked secret
PASS

The proof reads the configuration, the fixed function serves real reports and refuses all nine attempts, and the report passes every rubric line. Here is the proof run directly, followed by the fixed function given a real report and the proof.

$ cp records/disclosure-0.12.py lab/foundations/disclosure.py
$ python3 poc.py
read_report('../config.ini') returned:
  service configuration
  db_password = CANARY-reportsvc-0412
safe_read_report('q3-2026.txt'): served
safe_read_report('../config.ini'): refused
  report '../config.ini' is not a file in the reports folder

The proof returns the configuration file, password included, which is the evidence. The fixed function serves the quarterly report and refuses the proof's name with a reason. That reason is for the service's logs; the web layer should answer the caller with a plain not-found, so that a tester learns nothing about what was refused or why.

5

The Report

What a maintainer needs

The second part of the file is the report, the only part of this work the maintainers will ever see.

Visual Studio Codedisclosure.py - sec410-lab
disclosure.py
lab › foundations › disclosure.py
40REPORT = {41    'title': 'Path traversal in read_report exposes files outside the reports folder',42    'product': 'reportsvc',43    'affected_versions': '1.4.2 (earlier versions not tested)',44    'cwe': 'CWE-22',45    'summary': ('read_report(name) joins the requested name to the reports folder without resolving the result or '46                'checking that it stays inside the folder. A name containing ../ reads any file the service can read.'),47    'steps_to_reproduce': ("1. Call read_report('../config.ini'), or request GET /reports/../config.ini through the "48                           'web layer with the path left unnormalized. 2. The response is the contents of config.ini, '49                           'including the database password.'),50    'impact': ('An unauthenticated caller of the reports endpoint can read any file readable by the service account, '51               'including config.ini and its database credentials.'),52    'suggested_fix': ('Resolve the joined path with os.path.realpath and refuse any result whose common path with the '53                      'resolved reports folder is not that folder, or that is not a regular file. Do not compare paths as '54                      'strings: a sibling folder whose name starts with the same letters passes a prefix check.'),55    'cvss_vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N',56    'reporter': 'SEC410 student, via the lab',57    'disclosure_timeline': ('Reported privately to the maintainers on discovery; details held until a fixed version is '58                            'released or 90 days pass, whichever is first; the database password should be rotated now.'),59}
mainPythonUTF-8Ln 1, Col 1
The report the maintainers receive: everything needed to reproduce and fix, no secret.

Read it as the maintainer who receives it. The title says what is wrong and where. The product and version say exactly what was tested, and the version line says what was not. The weakness class tells them what kind of fix to reach for.

The steps reproduce the bug in one line, which is the single most important property of a report: a maintainer who can reproduce a bug in a minute believes it, and one who cannot puts it at the bottom of the queue.

The impact says who can do what, without exaggerating. The suggested fix is specific and warns about the obvious wrong fix. The timeline says what the reporter will do and when, and the report recommends rotating the password now, because the exposure exists whether or not the code is fixed.

The CVSS vector scores the finding with the Common Vulnerability Scoring System, version 4.0, released by FIRST on 1 November 2023. A v4.0 vector starts CVSS:4.0 and lists eleven base metrics. This one says the bug is reachable over the network, needs no special conditions, no privileges and no user interaction, exposes confidential data on the vulnerable system, and does not affect integrity, availability or any subsequent system.

Version 4.0 renamed the old temporal metrics the Threat group, added a Supplemental group that does not change the score, and introduced names for which groups a score includes: CVSS-B for base only, CVSS-BT, CVSS-BE and CVSS-BTE as threat and environmental information is added. A base score describes the bug; only the environmental metrics can describe what it means in a particular deployment.

Each metric in the vector is a claim, and the practice asks you to justify every one, because the vector is where reports most often overstate. Attack vector network holds because the function is reached through a web endpoint.

Privileges required none holds only if the reports endpoint is unauthenticated; the lab says it is, and a real report would say how the researcher knows. Confidentiality high holds because the file read reaches credentials, not just public reports. Integrity and availability none hold because the bug reads and never writes.

The subsequent-system metrics are the ones to argue about: the leaked password opens a database, a different system, yet the vector scores only what the bug itself does, and the report's impact section is where the onward consequence is described. A maintainer who disagrees with a metric will say so, and a reporter who has written down the reasoning can answer.

6

A Fix That Compares Strings, Measured

A prefix is not a folder

The first tempting fix checks that the resolved path starts with the folder's path.

Visual Studio Codedisclosure.py (Working Tree) - sec410-lab
disclosure.py (Working Tree)
Source Control › Changes › lab/foundations/disclosure.py
-     if os.path.commonpath([base, target]) != base or target == base or not os.path.isfile(target):34+     if not target.startswith(base) or not os.path.isfile(target):
main*1 file changed
The shortcut: check that the resolved path starts with the folder's path.

Run the check and read the refusal line.

$ cp records/disclosure-prefix.py lab/foundations/disclosure.py
$ python3 -m lab check f12 | grep -A1 "way out"
FAIL  the fixed function refuses every way out of the folder
      8 of 9 refused; let through: ['../reports-internal/staff-review.txt']

One name got through: ../reports-internal/staff-review.txt. The service has a sibling folder whose name begins with the same letters as the reports folder, so the resolved path of a file inside it starts with the reports folder's path, character for character, and the prefix check accepts it. Paths are made of components, and the test of containment has to compare components.

Adding a trailing separator to the prefix repairs this particular case, but it leaves the fix depending on getting string details right, such as separators, letter case on some file systems, and the folder itself; the common-path comparison states the intent directly. That is exactly what the draft's common-path comparison does, and why its suggested fix in the report warns against prefix checks by name.

7

A Fix That Blocks a Pattern, Measured

Two dots, and an absolute path

The second tempting fix refuses any name that contains two dots, which stops the proof and every relative traversal.

Visual Studio Codedisclosure.py (Working Tree) - sec410-lab
disclosure.py (Working Tree)
Source Control › Changes › lab/foundations/disclosure.py
-     base = os.path.realpath(service.BASE)-     target = os.path.realpath(os.path.join(base, name))-     if os.path.commonpath([base, target]) != base or target == base or not os.path.isfile(target):32+     if '..' in name:33+         raise ValueError(f'report {name!r} is not allowed')34+     target = os.path.join(service.BASE, name)35+     if not os.path.isfile(target):
main*1 file changed
The shortcut: refuse any name containing two dots.

Run the check and read the refusal lines.

$ cp records/disclosure-block.py lab/foundations/disclosure.py
$ python3 -m lab check f12 | grep -A2 "way out"
FAIL  the fixed function refuses every way out of the folder
      8 of 9 refused; let through: ['<reportsvc>/config.ini']
ok    the report has every section

An absolute path got through, with no two dots in it; the check abbreviates the service folder as <reportsvc>. Python's path join discards everything before an argument that is itself absolute, so joining the reports folder with an absolute path to the configuration file produces just that path.

The blocklist was written against the proof's input; the attacker's next input was not the proof's. A fix that resolves the path and tests where it ended up does not care how the input was written, and that is the property every fix for an input-handling bug should have.

Blocklists fail for a structural reason. They enumerate the inputs the author thought of, and the input space is larger than any list: absolute paths, encoded dots, alternate separators on other operating systems, and names that only become dangerous after another layer transforms them.

An allowlist of exact report names would also work here, and for a service with a fixed set of files it is the strongest fix. Resolving and testing containment is the general answer when the set of valid names is open-ended. Either way, the fix is judged by what it accepts, not by what it was written to stop.

When you review an assistant's fix for any input-handling bug, ask that question first: list what the fixed code will accept, then try the inputs on that list that the author did not mention, before reading the explanation of why the fix is correct.

8

Coordinated Disclosure

And what Module 12 adds

Finding, proving and fixing are the engineering. Disclosure is the agreement with the people who own the software about when the world finds out.

In coordinated disclosure, which ISO/IEC 29147:2018 sets out from the vendor's side with handling in ISO/IEC 30111, the finder reports privately to the maintainer, the maintainer confirms and fixes, users are given the fix, and details are published afterwards, usually with credit to the finder and a CVE identifier.

When a fix ships, a CVE Numbering Authority, often the vendor itself, assigns the identifier, and the advisory tells users which versions are affected and what to upgrade to.

Deadlines exist so that a report cannot be ignored indefinitely; the draft proposed ninety days, a common choice, and a researcher should extend it when a maintainer is responsive and working on the fix, and organizations publish how they want to receive reports, often in a security.txt file under /.well-known/ on their website, the format RFC 9116 described in April 2022.

When a maintainer does not answer, the finder does not publish the details the next morning. The usual steps are to try other contacts, then ask a coordinator, such as a national CERT, to reach the maintainer, and only after the stated deadline publish what users need to protect themselves.

Throughout, the finder keeps a dated record of every message, because the record is what shows the disclosure was coordinated rather than dropped on the maintainers.

Visual Studio Code0.12-session.md - sec410-lab
0.12-session.md
records › 0.12-session.md
1# Session 0.12: reproduce, fix, report23Assistant: Claude Opus 5.5 (claude-opus-5-5), the SEC410 build session, 2026-11-1845## Held6- Proof of concept: one name, reads config.ini, nothing more.7- Fix: realpath, then commonpath against the resolved folder,8  then a regular-file test. check f12: PASS, nine attempts9  refused, real reports served.10- Report: every section; CWE-22; CVSS 4.0 vector; no password.1112## Measured13- Prefix check: reports-internal passed, a sibling folder.14- Two-dot blocklist: an absolute path passed; join() discards15  the folder when the second argument is absolute.1617## For Module 1218- One bug, planted, in ten lines. The capstone's codebase is19  larger and its bugs are not announced.
mainMarkdownUTF-8Ln 11, Col 1

The review's last line is the difference between this lesson and Module 12. Here the bug was planted, announced and ten lines long.

The capstone's codebase is larger, its bugs are not announced, and an assistant helps find them, which brings every lesson in this module back at once: the assistant's suggestions have to be checked like any other claim, its proofs held to the same restraint, its fixes tested against inputs it did not think of, and its report read for anything it should not say.

Do

Practice

Reproduce, fix, report
the lab

Brief your assistant with the contract and the three constraints, check the draft, reproduce both shortcuts and record the name that beat each, then justify your CVSS vector one metric at a time.

Visual Studio Code0.12.md - sec410-lab
0.12.md
practice › 0.12.md
1# Practice 0.12: reproduce, fix, report23## Done when4- [ ] lab/foundations/disclosure.py meets its docstring's contract5- [ ] python -m lab check f12 prints PASS6- [ ] both shortcuts reproduced; the name that beat each recorded7- [ ] your CVSS vector justified metric by metric in your record8- [ ] records/0.12-<assistant>.md: brief, draft, runs, review910## Constraints11- The proof of concept reads config.ini and does nothing else.12- The leaked password appears in no record, report or commit.1314## Stretch15- Write the advisory you would publish after the fix: what16  changed, who is affected, how to tell if you were.
mainMarkdownUTF-8Ln 3, Col 1

A finding is credible when it can be reproduced in a minute, and a proof of concept proves the bug in the least harmful way and stops. CWE classifies the weakness, CVE names the instance, and CVSS 4.0 scores it from eleven base metrics.

A fix for an input-handling bug resolves the input and tests where it ends up: a prefix check let a sibling folder through, and a two-dot blocklist let an absolute path through. A report gives maintainers everything needed to reproduce and fix, and nothing they should not receive, and coordinated disclosure publishes once a fix exists.