capec Knowledge Bundle
Common Attack Pattern Enumeration and Classification (CAPEC) 3.9 (LinkML)
https://w3id.org/lmodel/capec/knowledge/Health48 concepts
- Confirmed by a person0 of 48
- Checked by automation only22
- Nobody has checked26
- Drafts48
- Reopened0
- Past review date0
- Edited since confirmed0
- Retired0
- Licence
- CC BY 4.0
- Publisher
- Noel McLoughlin
- As data
concepts.jsonldgraph.jsongraph.ntdatasets.jsonld
A LOKF knowledge base for capec. Every Markdown file under knowledge/ is one concept; together they form a queryable knowledge graph, derived from this repository’s code and docs.
Services#
- Documentation site - The knowledge website in
website/, a Hugo site that the Knowledge website workflow publishes to GitHub Pages athttps://lmodel.github.io/capec, built from the README,docs/, the schema’s pages and the bundle. It replaces the mkdocs site. - XML converter -
scripts/capec_to_json.py, the command that turns the CAPEC catalogue’s XML into the data the schema describes, by rules it reads from the XSD. It uses only the standard library and is deterministic.
Datasets#
- capec LinkML schema - The LinkML model of CAPEC 3.9 under its XSD 3.5,
src/capec/schema/capec.yaml(schema idhttps://w3id.org/lmodel/capec): an umbrella that holds only the tree root,CapecAttackPatternCatalog, over the modulescapec_entriesandcapec_core. - Core module -
src/capec/schema/capec_core.yaml, the module with the value lists, text types and small records every CAPEC entry shares, and the abstractCapecEntry. It imports onlylinkml:types. - Entries module -
src/capec/schema/capec_entries.yaml, the module withCapecAttackPattern,CapecCategoryandCapecView, the records an attack pattern holds, and the value lists they use, such asCapecAbstractionandCapecRelatedNature. - Generated artefacts - What
just gen-projectandjust gen-docgenerate from the capec schema: the projections inproject/, the Python models insrc/capec/datamodel/, and the merged schema indocs/schema/. None is edited by hand. - Example data - The examples
tests/test_data.pychecks: valid examples of each class, a counter-example for each constraint, and catalogues that break the rules a JSON Schema cannot state, intests/data/valid/,invalid/andproblem/invalid/. - Exploiting Software: How to Break Code - REF-1 from the catalogue, written as a concept of type
CapecExternalReferencein the adapt copy’s keys. It shows that the domain schema admits an external reference as a concept. - The schema’s adapt copy -
.lokf/schema/capec.yaml, the copyjust lokf-adaptwrites from the schema so that it sits beside LOKF’slokf.yaml: rooted onCapecEntryandCapecExternalReference, withIDandReference_IDdropped for LOKF’sid, and five keys folded intotitleanddescription. - Copy of the upstream -
upstream/: MITRE’s CAPEC XSD 3.5 and catalogue 3.9, each byte for byte what MITRE serves and pinned by git object hash, with the Terms of Use beside them. - Mapping term list -
tests/upstream/mapping-terms.txt, the classes and properties of Dublin Core, schema.org, SKOS and the SEPSES CAPEC ontology, whichscripts/extract_mapping_terms.pywrites from each vocabulary’s pinned file andtests/test_mappings.pyholds each mapping to. - Neighbours’ adapt copies - The adapt copies of twelve released lmodel repositories (slsa, github-actions, in-toto, oscal, spdx, stix, attack, uco, cve, kev-catalog, nist-nvd and cwe) in
tests/neighbours/, each pinned by its SHA-256, against whichtests/test_schema_rules.pyholds this schema’s copy apart andtests/test_mappings.pyholds the mappings.
References#
- CAPEC catalogue - The Common Attack Pattern Enumeration and Classification, the catalogue of attack patterns that The MITRE Corporation publishes as XML. Version 3.9 of 24 January 2023 is the latest, with 615 attack patterns, 78 categories, 13 views and 440 external references.
- CAPEC XSD - The XML Schema of the CAPEC catalogue, version 3.5, namespace
http://capec.mitre.org/capec-3. Its own header says 3.5.0, dated 21 October 2021. The schema’s keys and listed values are this file’s. - CAPEC Terms of Use - MITRE’s terms for CAPEC: a non-exclusive, royalty-free licence for research, development and commercial use, under which a copy must reproduce MITRE’s copyright designation and the licence. NOTICE and
upstream/TERMS.txtdo so.
Explanations#
- Keys and values - Why the schema’s keys and values are spelled as they are: each key is the XSD’s own element or attribute name, such as
Related_Attack_Patterns, each value the XSD’s own text, and classes and enums carry aCapecprefix. - From XML to data - Why a converter stands between the catalogue and the schema, and its rules: MITRE publishes XML, LinkML validates keys and values, and
scripts/capec_to_json.pyturns one into the other without changing a key or a value. A test turns the data back and finds the catalogue. - Identifiers and references - Why a CAPEC number is a string of digits and why references are typed: a number names and never counts, and the rdflib dumper cannot expand a bare identifier, so RDF comes through JSON-LD.
Exclude_IDranges over any entry, because the XSD says only that it names an ancestor. - Why abstraction levels are values - Why Meta, Standard and Detailed are values of
Abstractionand not subclasses: no field depends on them. The XSD says an execution flow is usually for Detailed patterns, and CAPEC 3.9 gives flows to all three levels, so no rule ties them. - Rules in Python - Why
tests/capec_rules.pyexists: a JSON Schema looks at one value at a time, so it cannot say that a reference names an entry the catalogue holds, or that no number is used twice. What the data merely shows goes intests/test_catalogue.pywith its counts. - Faults in the catalogue - The oddities of CAPEC 3.9 that
tests/test_catalogue.pypins: CAPEC-244 citesREF-97, which the catalogue lacks, two patterns repeat a weakness, two names end in a space, two skills hold no text, eleven flows repeat a step number, and CAPEC-699 is a Meta child of a Standard pattern. - Mappings - Where the schema crosses to other vocabularies: STIX, ATT&CK, CWE, the SEPSES CAPEC ontology, SKOS, Dublin Core, schema.org and Wikidata. The schema is the one home for mappings, and each is read at its source and held by a test.
- What the generators do with these keys - How LinkML’s generators treat the XSD’s short keys:
gen-owlwarns that six keys shared across classes are ambiguous and gives them no label, the JSON-LD context gives a key one IRI, and the keyDateshares a docs page with LinkML’s type. - What the schema leaves out - What the schema does not do: it says nothing about whether an entry is true, nothing evaluates a view’s filter, and it holds the keys the XSD defines even where CAPEC 3.9 uses none, such as
AudienceandMember_Of.
Glossary#
- Attack pattern - An attack pattern: a catalogued way that adversaries go about an attack, with what it takes and how to resist it. The class is
CapecAttackPattern. - Category - A CAPEC category: a group of attack patterns that share an effect or intent, and not itself a pattern of attack. The class is
CapecCategory, and CAPEC 3.9 holds 78. - View - A CAPEC view: one way of looking over the catalogue, as a hierarchy (
Graph) or a slice (Implicitby a filter,Explicitby hand). The class isCapecView, and CAPEC 3.9 holds 13. - Abstraction level - How concrete an attack pattern is:
Metafor a broad approach,Standardfor one method or technique, andDetailedfor one technique against one technology. The enum isCapecAbstraction. - Execution flow - The steps an adversary typically takes in an attack, each with a number, a phase (
Explore,ExperimentorExploit), a description and ways of doing it. The key isExecution_Flow, and the class of a step isCapecAttackStep. - Structured text - Text in the catalogue that may hold XHTML markup, such as paragraphs and lists. The XSD’s type is
StructuredTextType, and the schema’s iscapec_structured_text, a string that keeps the markup without its namespace prefix. - Adapt copy - An adapt copy: the copy of a published LinkML schema that
lokf adaptwrites so that it can sit beside LOKF’slokf.yamlin a domain schema, with its chosen roots onConcept.
Playbooks#
- Validate a catalogue - How to validate a CAPEC catalogue: turn the XML into data with
scripts/capec_to_json.py, runlinkml-validatewith the classCapecAttackPatternCatalog, and runtests/capec_rules.pyfor what a JSON Schema cannot state. - Regenerate and test - How to change the schema: edit
src/capec/schema/, runjust lint,just gen-project,just gen-doc,just lokf-adaptandjust test, and commit what they write. Generated files are never edited by hand. - Release - How a release happens:
semantic-release.ymlreads Conventional Commits onmain, promotes the## [Unreleased]section, tags and publishes. The first release needs thev0.0.0baseline tag onmain, and PyPI publishing stays off. - Move to another version - How to answer the upstream watch when MITRE publishes another CAPEC version or XSD: read what changed, then move
upstream/, the pins inscripts/check_upstream_release.pyand the schema headers together, and let the coverage test say what else moved. - Knowledge sources map - The librarian’s scrape map: every repository location and external source this bundle derives concepts from, how to re-check each, and the tracked paths left out with their reasons.
Policies#
- AI covenant - The rules for AI-assisted work here: whoever submits owns the contribution, an element says what the XSD says, a rule states only what the upstream states, a mapping is read at its source, and no commit carries an AI co-authorship trailer.
- Licence and attribution - The repository’s licences and what it takes from elsewhere: Apache-2.0 for the schema and code, CC BY 4.0 for the bundle, and MITRE’s CAPEC Terms of Use for the XSD and catalogue, whose designation and licence NOTICE reproduces. No endorsement is implied.
- Security policy - How to report a vulnerability in this repository, by GitHub’s private reporting, what executes here and what holds each surface. A problem in CAPEC itself goes to the CAPEC team.
Workflows#
- Build and test (main.yaml) - The Build and test workflow: on every pull request and push to
main, it runsjust teston Python 3.11 to 3.14, and lints the schema and checks the adapt copy on 3.13. - Lint and docs (lint-and-docs.yaml) - The static checks on pull requests, on
mainand every Monday: ShellCheck, actionlint, the word budgets of CONTRIBUTING.md and SECURITY.md, markdownlint, lychee and codespell. - Semantic release (semantic-release.yml) - The workflow that computes the next version from Conventional Commits on
main, promotes the changelog, tags and publishes a GitHub Release, and dispatches the knowledge release onceKNOWLEDGE_RELEASE_ENABLEDistrue. - Upstream watch (upstream-watch.yaml) - The weekly check that
scripts/check_upstream_release.pyruns: another CAPEC version, a changed XSD or catalogue, changed Terms of Use or a new news item fails the run and opens or updates an issue. - Knowledge librarian (knowledge-librarian.yaml) - The sidecar’s scheduled agent run that keeps the bundle in step with the repository and opens a pull request for a person to review. It is inert until
KNOWLEDGE_LIBRARIAN_ENABLEDistrue. - Knowledge registrar (knowledge-registrar.yaml) - The gate on the bundle: it validates the bundle on each pull request that touches it and weekly, and checks that each new
human:event in a pull request is backed by an approval or a signature. It never judges whether content is true. - Knowledge release (knowledge-release.yaml) - The workflow that attaches the bundle, a Copilot skill and the schema’s adapt copy to a GitHub release, each with a checksum. It starts by hand or, once
KNOWLEDGE_RELEASE_ENABLEDistrue, on each published release. - Knowledge sync (knowledge-sync.yaml) - The weekly workflow that keeps the sidecar’s copies and the skills pin at the newest release of Knowledge Trust Ladder, by one pull request that a person merges.
- Knowledge website (knowledge-website.yaml) - The workflow that builds
website/on each pull request that touches its inputs, and deploys the default branch’s build to GitHub Pages onceKNOWLEDGE_WEBSITE_ENABLEDistrue.