1*6236dae4SAndroid Build Coastguard Worker<!-- 2*6236dae4SAndroid Build Coastguard WorkerCopyright (C) Daniel Stenberg, <[email protected]>, et al. 3*6236dae4SAndroid Build Coastguard Worker 4*6236dae4SAndroid Build Coastguard WorkerSPDX-License-Identifier: curl 5*6236dae4SAndroid Build Coastguard Worker--> 6*6236dae4SAndroid Build Coastguard Worker 7*6236dae4SAndroid Build Coastguard Worker# Anatomy of a curl security advisory 8*6236dae4SAndroid Build Coastguard Worker 9*6236dae4SAndroid Build Coastguard WorkerAs described in the [Security Process](https://curl.se/dev/secprocess.html) 10*6236dae4SAndroid Build Coastguard Workerdocument, when a security vulnerability has been reported to the project and 11*6236dae4SAndroid Build Coastguard Workerconfirmed, we author an advisory document for the issue. It should ideally 12*6236dae4SAndroid Build Coastguard Workerbe written in cooperation with the reporter to make sure all the angles and 13*6236dae4SAndroid Build Coastguard Workerdetails of the problem are gathered and described correctly and succinctly. 14*6236dae4SAndroid Build Coastguard Worker 15*6236dae4SAndroid Build Coastguard Worker## New document 16*6236dae4SAndroid Build Coastguard Worker 17*6236dae4SAndroid Build Coastguard WorkerA security advisory for curl is created in the `docs/` folder in the 18*6236dae4SAndroid Build Coastguard Worker[curl-www](https://github.com/curl/curl-www) repository. It should be named 19*6236dae4SAndroid Build Coastguard Worker`$CVEID.md` where `$CVEID` is the full CVE Id that has been registered for the 20*6236dae4SAndroid Build Coastguard Workerflaw. Like `CVE-2016-0755`. The `.md` extension of course means that the 21*6236dae4SAndroid Build Coastguard Workerdocument is written using markdown. 22*6236dae4SAndroid Build Coastguard Worker 23*6236dae4SAndroid Build Coastguard WorkerThe standard way to go about this is to first write the `VULNERABILITY` 24*6236dae4SAndroid Build Coastguard Workersection for the document, so that there is description of the flaw available, 25*6236dae4SAndroid Build Coastguard Workerthen paste this description into the CVE Id request. 26*6236dae4SAndroid Build Coastguard Worker 27*6236dae4SAndroid Build Coastguard Worker### `vuln.pm` 28*6236dae4SAndroid Build Coastguard Worker 29*6236dae4SAndroid Build Coastguard WorkerThe new issue should be entered at the top of the list in the file `vuln.pm` 30*6236dae4SAndroid Build Coastguard Workerin the same directory. It holds a large array with all published curl 31*6236dae4SAndroid Build Coastguard Workervulnerabilities. All fields should be filled in accordingly, separated by a 32*6236dae4SAndroid Build Coastguard Workerpipe character (`|`). 33*6236dae4SAndroid Build Coastguard Worker 34*6236dae4SAndroid Build Coastguard WorkerThe eleven fields for each CVE in `vuln.pm` are, in order: 35*6236dae4SAndroid Build Coastguard Worker 36*6236dae4SAndroid Build Coastguard Worker HTML page name, first vulnerable version, last vulnerable version, name of 37*6236dae4SAndroid Build Coastguard Worker the issue, CVE Id, announce date (`YYYYMMDD`), report to the project date 38*6236dae4SAndroid Build Coastguard Worker (`YYYYMMDD`), CWE, awarded reward amount (USD), area (single word), C-issue 39*6236dae4SAndroid Build Coastguard Worker (`-` if not a C issue at all, `OVERFLOW` , `OVERREAD`, `DOUBLE_FREE`, 40*6236dae4SAndroid Build Coastguard Worker `USE_AFTER_FREE`, `NULL_MISTAKE`, `UNINIT`) 41*6236dae4SAndroid Build Coastguard Worker 42*6236dae4SAndroid Build Coastguard Worker### `Makefile` 43*6236dae4SAndroid Build Coastguard Worker 44*6236dae4SAndroid Build Coastguard WorkerThe new CVE webpage filename needs to be added in the `Makefile`'s `CVELIST` 45*6236dae4SAndroid Build Coastguard Workermacro. 46*6236dae4SAndroid Build Coastguard Worker 47*6236dae4SAndroid Build Coastguard WorkerWhen the markdown is in place and the `Makefile` and `vuln.pm` are updated, 48*6236dae4SAndroid Build Coastguard Workerall other files and metadata for all curl advisories and versions get 49*6236dae4SAndroid Build Coastguard Workergenerated automatically using those files. 50*6236dae4SAndroid Build Coastguard Worker 51*6236dae4SAndroid Build Coastguard Worker## Document format 52*6236dae4SAndroid Build Coastguard Worker 53*6236dae4SAndroid Build Coastguard WorkerThe easy way is to start with a recent previously published advisory and just 54*6236dae4SAndroid Build Coastguard Workerblank out old texts and save it using a new name. Save the subtitles and 55*6236dae4SAndroid Build Coastguard Workergeneral layout. 56*6236dae4SAndroid Build Coastguard Worker 57*6236dae4SAndroid Build Coastguard WorkerSome details and metadata are extracted from this document so it is important 58*6236dae4SAndroid Build Coastguard Workerto stick to the existing format. 59*6236dae4SAndroid Build Coastguard Worker 60*6236dae4SAndroid Build Coastguard WorkerThe first list must be the title of the issue. 61*6236dae4SAndroid Build Coastguard Worker 62*6236dae4SAndroid Build Coastguard Worker### VULNERABILITY 63*6236dae4SAndroid Build Coastguard Worker 64*6236dae4SAndroid Build Coastguard WorkerThe first subtitle should be `VULNERABILITY`. That should then include a 65*6236dae4SAndroid Build Coastguard Workerthrough and detailed description of the flaw. Including how it can be 66*6236dae4SAndroid Build Coastguard Workertriggered and maybe something about what might happen if triggered or 67*6236dae4SAndroid Build Coastguard Workerexploited. 68*6236dae4SAndroid Build Coastguard Worker 69*6236dae4SAndroid Build Coastguard Worker### INFO 70*6236dae4SAndroid Build Coastguard Worker 71*6236dae4SAndroid Build Coastguard WorkerThe next section is `INFO` which adds meta data information about the flaw. It 72*6236dae4SAndroid Build Coastguard Workerspecifically mentions the official CVE Id for the issue and it must list the 73*6236dae4SAndroid Build Coastguard WorkerCWE Id, starting on its own line. We write CWE identifiers in advisories with 74*6236dae4SAndroid Build Coastguard Workerthe full (official) explanation on the right side of a colon. Like this: 75*6236dae4SAndroid Build Coastguard Worker 76*6236dae4SAndroid Build Coastguard Worker`CWE-305: Authentication Bypass by Primary Weakness` 77*6236dae4SAndroid Build Coastguard Worker 78*6236dae4SAndroid Build Coastguard Worker### AFFECTED VERSIONS 79*6236dae4SAndroid Build Coastguard Worker 80*6236dae4SAndroid Build Coastguard WorkerThe third section first lists what versions that are affected, then adds 81*6236dae4SAndroid Build Coastguard Workerclarity by stressing what versions that are *not* affected. A third line adds 82*6236dae4SAndroid Build Coastguard Workerinformation about which specific git commit that introduced the vulnerability. 83*6236dae4SAndroid Build Coastguard Worker 84*6236dae4SAndroid Build Coastguard WorkerThe `Introduced-in` commit should be a full URL that displays the commit, but 85*6236dae4SAndroid Build Coastguard Workershould work as a stand-alone commit hash if everything up to the last slash is 86*6236dae4SAndroid Build Coastguard Workercut out. 87*6236dae4SAndroid Build Coastguard Worker 88*6236dae4SAndroid Build Coastguard WorkerAn example using the correct syntax: 89*6236dae4SAndroid Build Coastguard Worker 90*6236dae4SAndroid Build Coastguard Worker~~~ 91*6236dae4SAndroid Build Coastguard Worker- Affected versions: curl 7.16.1 to and including 7.88.1 92*6236dae4SAndroid Build Coastguard Worker- Not affected versions: curl < 7.16.1 and curl >= 8.0.0 93*6236dae4SAndroid Build Coastguard Worker- Introduced-in: https://github.com/curl/curl/commit/2147284cad 94*6236dae4SAndroid Build Coastguard Worker~~~ 95*6236dae4SAndroid Build Coastguard Worker 96*6236dae4SAndroid Build Coastguard Worker### THE SOLUTION 97*6236dae4SAndroid Build Coastguard Worker 98*6236dae4SAndroid Build Coastguard WorkerThis section describes and discusses the fix. The only mandatory information 99*6236dae4SAndroid Build Coastguard Workerhere is the link to the git commit that fixes the problem. 100*6236dae4SAndroid Build Coastguard Worker 101*6236dae4SAndroid Build Coastguard WorkerThe `Fixed-in` value should be a full URL that displays the commit, but should 102*6236dae4SAndroid Build Coastguard Workerwork as a stand-alone commit hash if everything up to the last slash is cut 103*6236dae4SAndroid Build Coastguard Workerout. 104*6236dae4SAndroid Build Coastguard Worker 105*6236dae4SAndroid Build Coastguard WorkerExample: 106*6236dae4SAndroid Build Coastguard Worker 107*6236dae4SAndroid Build Coastguard Worker`- Fixed-in: https://github.com/curl/curl/commit/af369db4d3833272b8ed` 108*6236dae4SAndroid Build Coastguard Worker 109*6236dae4SAndroid Build Coastguard Worker### RECOMMENDATIONS 110*6236dae4SAndroid Build Coastguard Worker 111*6236dae4SAndroid Build Coastguard WorkerThis section lists the recommended actions for the users in a top to bottom 112*6236dae4SAndroid Build Coastguard Workerpriority order and should ideally contain three items but no less than two. 113*6236dae4SAndroid Build Coastguard Worker 114*6236dae4SAndroid Build Coastguard WorkerThe top two are almost always `upgrade curl to version XXX` and `apply the 115*6236dae4SAndroid Build Coastguard Workerpatch to your local version`. 116*6236dae4SAndroid Build Coastguard Worker 117*6236dae4SAndroid Build Coastguard Worker### TIMELINE 118*6236dae4SAndroid Build Coastguard Worker 119*6236dae4SAndroid Build Coastguard WorkerDetail when this report was received in the project. When package distributors 120*6236dae4SAndroid Build Coastguard Workerwere notified (via the distros mailing list or similar) 121*6236dae4SAndroid Build Coastguard Worker 122*6236dae4SAndroid Build Coastguard WorkerWhen the advisory and fixed version are released. 123*6236dae4SAndroid Build Coastguard Worker 124*6236dae4SAndroid Build Coastguard Worker### CREDITS 125*6236dae4SAndroid Build Coastguard Worker 126*6236dae4SAndroid Build Coastguard WorkerMention the reporter and patch author at least, then everyone else involved 127*6236dae4SAndroid Build Coastguard Workeryou think deserves a mention. 128*6236dae4SAndroid Build Coastguard Worker 129*6236dae4SAndroid Build Coastguard WorkerIf you want to mention more than one name, separate the names with comma 130*6236dae4SAndroid Build Coastguard Worker(`,`). 131*6236dae4SAndroid Build Coastguard Worker 132*6236dae4SAndroid Build Coastguard Worker~~~ 133*6236dae4SAndroid Build Coastguard Worker- Reported-by: Full Name 134*6236dae4SAndroid Build Coastguard Worker- Patched-by: Full Name 135*6236dae4SAndroid Build Coastguard Worker~~~ 136