Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Lesson 5 of 6 · Worked example · 20 min · revision 2

Sharing and Operationalising Indicators

Turn a finished phishing case into intelligence others can use: build a STIX 2.1 bundle with TLP 2.0 markings using the stix2 library, validate it with the OASIS validator, export only what each audience may receive, and let indicators decay and expire in your own controls. Covers TAXII and MISP as the ways bundles travel.

Contentsand lesson path

What you will learn

  • Turn a published threat report or advisory into action: extract indicators and behaviours, rank them with the pyramid of pain, structure the intrusion with the Diamond Model, and decide which become blocks, detections or hunts.
  • Triage a suspicious file in an isolated environment with static checks (hashes, strings, file metadata, YARA) and sandbox behaviour, recognise obfuscation or packing, and decide when to escalate to a reverse engineer.

01. The problem

The INV-7731 case from the phishing lab is closed. Two other organisations in your sector sharing group received similar invoice emails, and your manager asks you to share what you found. You also need the indicators in your own blocklists and detections, but not forever.

Sharing helps everybody only if the receiver can read the data automatically and knows the rules for passing it on. NIST SP 800-150 describes the benefits and the duties of sharing, including the protection of personal data that turns up in threat information. Three standards do most of the work. STIX 2.1 (Structured Threat Information Expression, from OASIS) is a JSON format for threat intelligence. TAXII 2.1 is an HTTPS API for exchanging STIX. The Traffic Light Protocol (TLP 2.0, from FIRST) labels how far each item may travel.

The case left three candidates: the phishing domain, the attachment hash, and the lure URL. The URL contains u=amy.lee, the name of your user, so it must not leave your organisation. The relay address 203.0.113.45 is not a candidate at all: it belongs to a bulk-mail service that many legitimate senders use, and publishing it would cause blocks of innocent mail at every receiver.

02. Step 1: Install the libraries

stix2 is the OASIS Python library for creating and parsing STIX objects; stix2-validator checks documents against the specification. Tested with Python 3.12.13.

Terminal
mkdir stix-lab && cd stix-lab
export PIP_DISABLE_PIP_VERSION_CHECK=1
python3 -m venv .venv
.venv/bin/pip install -q stix2==3.0.2 stix2-validator==3.3.2
.venv/bin/pip list 2>/dev/null | grep -E '^stix2'
Expected output
stix2                     3.0.2
stix2-patterns            2.1.2
stix2-validator           3.3.2

03. Step 2: Define the TLP 2.0 markings

TLP 2.0 has five labels. TLP:CLEAR may be shared with anyone. TLP:GREEN may go to the recipient's community, but not to the public. TLP:AMBER may go to the recipient's organisation and its clients, on a need-to-know basis. TLP:AMBER+STRICT may go only within the recipient's organisation. TLP:RED is for the named recipients only, with no further disclosure.

In STIX, a label is a marking definition object, and other objects point to it in object_marking_refs. The stix2 library ships constants only for TLP 1.0, which used TLP:WHITE. For TLP 2.0, OASIS publishes five marking definitions with fixed IDs and an extension that holds the level. tlp2.py recreates them exactly, so that any receiver recognises the IDs.

Python · stix-lab/tlp2.py
"""The five TLP 2.0 marking definitions, with the fixed IDs that OASIS publishes."""
import stix2

EXT = "extension-definition--60a3c5c5-0d10-413e-aab3-9e08dde9e88d"
IDS = {
    "clear": "94868c89-83c2-464b-929b-a1a8aa3c8487",
    "green": "bab4a63c-aed9-4cf5-a766-dfca5abac2bb",
    "amber": "55d920b0-5e8b-4f79-9ee9-91f868d9b421",
    "amber+strict": "939a9414-2ddd-4d32-a0cd-375ea402b003",
    "red": "e828b379-4e03-4974-9ac4-e53a884c97c1",
}
TLP = {
    level: stix2.MarkingDefinition(
        id=f"marking-definition--{uuid}", created="2022-10-01T00:00:00.000Z",
        name=f"TLP:{level.upper()}",
        extensions={EXT: {"extension_type": "property-extension", "tlp_2_0": level}})
    for level, uuid in IDS.items()
}

04. Step 3: Build the bundle

A STIX bundle is a container for objects. Domain objects describe things: an identity (who produced the data), a campaign, an attack-pattern (an ATT&CK technique, linked by its external ID) and indicators. An indicator holds a pattern in STIX's own pattern language, such as [domain-name:value = 'northwind-pay.test'], and a valid_from and valid_until: the window in which you consider it a sign of the activity. Relationship objects connect the others: an indicator indicates the campaign, the campaign uses the technique, and a sighting says the hash was seen five times at your organisation.

STIX 2.1 asks for version 4 (random) UUIDs in domain object IDs. The script draws them from a seeded random generator only so that your output matches this page; in production, let the library generate them.

Python · stix-lab/build_bundle.py
"""Package the INV-7731 case as a STIX 2.1 bundle with TLP 2.0 markings."""
import random
import uuid
from datetime import datetime, timedelta

import stix2

from tlp2 import TLP

RNG = random.Random(7731)  # lab only: seeded so every run prints the same IDs
T0 = "2026-11-09T12:00:00.000Z"
SEEN = datetime.fromisoformat("2026-11-09T08:14:05+00:00")


def sid(kind):
    """A random (version 4) UUID, as STIX 2.1 asks for domain objects."""
    return f"{kind}--{uuid.UUID(int=RNG.getrandbits(128), version=4)}"


soc = stix2.Identity(id=sid("identity"), created=T0, modified=T0,
                     name="Corp SOC (lab)", identity_class="organization",
                     object_marking_refs=[TLP["clear"]])
meta = dict(created=T0, modified=T0, created_by_ref=soc.id)
campaign = stix2.Campaign(id=sid("campaign"), name="INV-7731 invoice lure",
                          description="Fake overdue-invoice emails to finance staff.",
                          object_marking_refs=[TLP["green"]], **meta)
technique = stix2.AttackPattern(
    id=sid("attack-pattern"), name="Spearphishing Link",
    external_references=[{"source_name": "mitre-attack", "external_id": "T1598.003",
                          "url": "https://attack.mitre.org/techniques/T1598/003/"}],
    object_marking_refs=[TLP["clear"]], **meta)


def indicator(name, text, pattern, days, tlp, confidence):
    return stix2.Indicator(
        id=sid("indicator"), name=name, description=text, pattern=pattern,
        pattern_type="stix", indicator_types=["malicious-activity"],
        valid_from=SEEN, valid_until=SEEN + timedelta(days=days),
        confidence=confidence, object_marking_refs=[TLP[tlp]], **meta)


H = "36085315acaf584570f0642c16f0a8b1150269bc7ea856f235786676edcf16b1"
indicators = [
    indicator("Phishing domain", "Hosts the fake sign-in page; registered 2 days "
              "before the email.", "[domain-name:value = 'northwind-pay.test']",
              30, "green", 85),
    indicator("Remittance_7731.html", "HTML attachment with a credential form.",
              f"[file:hashes.'SHA-256' = '{H}']", 90, "green", 70),
    indicator("Victim tracking link", "Lure URL; the u= value names our user.",
              "[url:value = 'http://billing.northwind-pay.test/l/7731?u=amy.lee']",
              30, "red", 90),
]
links = [stix2.Relationship(i, "indicates", campaign, id=sid("relationship"),
                            object_marking_refs=[TLP["green"]], **meta)
         for i in indicators]
links.append(stix2.Relationship(campaign, "uses", technique, id=sid("relationship"),
                                object_marking_refs=[TLP["green"]], **meta))
sighting = stix2.Sighting(id=sid("sighting"), sighting_of_ref=indicators[1],
                          where_sighted_refs=[soc], count=5, first_seen=SEEN,
                          last_seen="2026-11-09T08:31:40Z",
                          object_marking_refs=[TLP["green"]], **meta)

objects = [soc, campaign, technique, *indicators, *links, sighting]
used = {ref for obj in objects for ref in obj.object_marking_refs}
markings = [m for m in TLP.values() if m.id in used]
bundle = stix2.Bundle(*objects, *markings, id=sid("bundle"))
open("bundle.json", "w").write(bundle.serialize(pretty=True))
names = {m.id: m.name for m in TLP.values()}
for obj in objects:
    label = obj.get("name") or obj.get("relationship_type") or f"count={obj.count}"
    print(f"{obj.type:<15} {label:<24} {names[obj.object_marking_refs[0]]}")
print(f"{len(bundle.objects)} objects written to bundle.json")
Terminal
.venv/bin/python build_bundle.py
Expected output
identity        Corp SOC (lab)           TLP:CLEAR
campaign        INV-7731 invoice lure    TLP:GREEN
attack-pattern  Spearphishing Link       TLP:CLEAR
indicator       Phishing domain          TLP:GREEN
indicator       Remittance_7731.html     TLP:GREEN
indicator       Victim tracking link     TLP:RED
relationship    indicates                TLP:GREEN
relationship    indicates                TLP:GREEN
relationship    indicates                TLP:GREEN
relationship    uses                     TLP:GREEN
sighting        count=5                  TLP:GREEN
14 objects written to bundle.json

Each object carries exactly one TLP label. The domain and the hash are TLP:GREEN, safe for the sharing community. The victim tracking link is TLP:RED: you keep it for your own blocklist. The confidence value (0 to 100) says how sure you are, and the valid_until dates differ by type: thirty days for the domain, ninety for the hash. These are your policy choices, and they travel with the data so that receivers can apply or override them.

05. Step 4: Validate the bundle, and check the validator

Run the OASIS validator through a short wrapper that prints one line per finding. Then break one pattern on purpose and confirm that the validator rejects it: a check you have never seen fail proves little.

Python · stix-lab/validate.py
"""Check a bundle with the OASIS STIX 2.1 validator and print a short summary."""
import sys
import textwrap

from stix2validator import ValidationOptions, validate_file

result = validate_file(sys.argv[1], ValidationOptions())
print(f"{sys.argv[1]}: valid={result.is_valid}")
for obj in result.object_results:
    for kind, messages in (("ERROR", obj.errors), ("warning", obj.warnings)):
        for message in map(str, messages):
            where, _, text = message.partition(": ")
            print(textwrap.fill(f"{kind} in {where.split('--')[0]}: {text}", 80,
                                initial_indent="  ", subsequent_indent="    "))
sys.exit(0 if result.is_valid else 1)
Terminal
.venv/bin/python validate.py bundle.json
Expected output
bundle.json: valid=True
  warning in attack-pattern: {302} External reference 'mitre-attack' has a URL
    but no hash.
Terminal
sed "s/= 'northwind-pay.test'/= northwind-pay.test/" bundle.json > broken.json
.venv/bin/python validate.py broken.json; echo "exit=$?"
Expected output
broken.json: valid=False
  ERROR in indicator: Pattern failed to validate: FAIL: Error found at line
    1:21. mismatched input 'northwind-pay' expecting {IntNegLiteral,
    IntPosLiteral, FloatNegLiteral, FloatPosLiteral, HexLiteral, BinaryLiteral,
    StringLiteral, BoolLiteral, TimestampLiteral}.
  warning in attack-pattern: {302} External reference 'mitre-attack' has a URL
    but no hash.
exit=1

The bundle is valid. The one warning is a best-practice note: an external reference with a URL should also carry a hash of the page. Many producers, including MITRE's own ATT&CK data, leave it out, so you can accept it. The broken copy fails on the pattern, because a string value needs quotes. Run the validator in your sharing pipeline, so that a bad object does not reach a partner's blocklist.

06. Step 5: Export only what an audience may receive

Marking objects is half the job; the export must respect the marks. share.py keeps an object only if every marking on it is allowed for the audience. An unmarked object is held back, which is the safe default. It then drops any relationship or sighting that points to something held back, because a dangling reference reveals that the object exists and can break a receiver's import. Finally it checks the result with a negative test: the victim's name must not appear anywhere in the community file.

Python · stix-lab/share.py
"""Export only the objects that an audience may receive under TLP 2.0."""
import json
import sys
import uuid

ALLOWED = {  # what we let an automated feed carry to each audience
    "community": {"TLP:CLEAR", "TLP:GREEN"},
    "partner": {"TLP:CLEAR", "TLP:GREEN", "TLP:AMBER"},
}
bundle, audience = json.load(open(sys.argv[1])), sys.argv[2]
marking = {o["id"]: o for o in bundle["objects"] if o["type"] == "marking-definition"}


def refs(obj):
    """IDs this object points to: created_by_ref, source_ref, where_sighted_refs..."""
    out = []
    for key, value in obj.items():
        if key.endswith("_ref"):
            out.append(value)
        elif key.endswith("_refs") and key != "object_marking_refs":
            out.extend(value)
    return out


def shareable(obj):  # an unmarked object is never shared
    names = [marking[r]["name"] for r in obj.get("object_marking_refs", [])]
    return bool(names) and all(n in ALLOWED[audience] for n in names)


keep = {o["id"]: o for o in bundle["objects"]
        if o["id"] not in marking and shareable(o)}
changed = True
while changed:  # drop links whose other end was held back, until nothing changes
    dangling = [i for i, o in keep.items() if any(r not in keep for r in refs(o))]
    changed = bool(dangling)
    for i in dangling:
        del keep[i]
used = {r for o in keep.values() for r in o["object_marking_refs"]}
export = list(keep.values()) + [marking[r] for r in sorted(used)]
held = [o for o in bundle["objects"] if o["id"] not in keep and o["id"] not in marking]
for o in held:
    print(f"held back: {o['type']} {o.get('name', o.get('relationship_type', ''))}")
out = {"type": "bundle", "id": f"bundle--{uuid.uuid4()}", "objects": export}
json.dump(out, open(f"share-{audience}.json", "w"), indent=2)
print(f"share-{audience}.json: {len(export)} objects, markings "
      f"{sorted(marking[r]['name'] for r in used)}")
Terminal
.venv/bin/python share.py bundle.json community
grep -c 'u=amy.lee' share-community.json || echo "no victim link in the export"
Expected output
held back: indicator Victim tracking link
held back: relationship indicates
share-community.json: 11 objects, markings ['TLP:CLEAR', 'TLP:GREEN']
0
no victim link in the export

The RED indicator and the relationship that pointed to it stayed home. The export now has to travel. With TAXII 2.1, a server offers API roots, each with collections: a client adds objects to a collection with a POST and fetches new ones with a GET, using added_after to receive only what is new. Many sharing groups run MISP, an open-source sharing platform. MISP stores events with attributes, can import and export STIX, and marks which attributes are meant for detection with the to_ids flag. Its warning lists flag values that are probably harmless, such as public DNS resolvers or cloud ranges, before anyone blocks them. Whatever the transport, record sightings when you see a shared indicator yourself: they tell the producer it is still live.

07. Step 6: Let indicators decay in your own controls

An indicator does not become false on its expiry date; it slowly loses value as the attacker moves on. operationalise.py lowers each indicator's score by half every half-life (fourteen days for domains, seven for URLs, sixty for file hashes in this example policy), blocks while the score is high, only alerts when it drops, and retires an indicator at its valid_until date or when the score becomes too low. MISP has a similar, configurable decaying model.

Python · stix-lab/operationalise.py
"""Decide, for a given day, what each indicator should still do in our controls."""
import json
import sys
from datetime import datetime

HALF_LIFE = {"domain-name": 14, "url": 7, "file": 60}  # days; an example policy


def when(text):
    return datetime.fromisoformat(text.replace("Z", "+00:00"))


today = when(sys.argv[2] + "T00:00:00Z")
print(f"as of {sys.argv[2]}")
for obj in json.load(open(sys.argv[1]))["objects"]:
    if obj["type"] != "indicator":
        continue
    kind = obj["pattern"][1:].split(":")[0]
    age = (today - when(obj["valid_from"])).days
    score = obj["confidence"] * 0.5 ** (age / HALF_LIFE[kind])
    if today >= when(obj["valid_until"]):
        action = "retire (expired)"
    elif score >= 50:
        action = "block and alert"
    elif score >= 20:
        action = "alert only"
    else:
        action = "retire (low score)"
    print(f"  {obj['name']:<21} {kind:<12} age {age:>2}d score {score:>3.0f}  {action}")
Terminal
for day in 2026-11-12 2026-11-30 2026-12-20; do
  .venv/bin/python operationalise.py bundle.json $day
done
Expected output
as of 2026-11-12
  Phishing domain       domain-name  age  2d score  77  block and alert
  Remittance_7731.html  file         age  2d score  68  block and alert
  Victim tracking link  url          age  2d score  74  block and alert
as of 2026-11-30
  Phishing domain       domain-name  age 20d score  32  alert only
  Remittance_7731.html  file         age 20d score  56  block and alert
  Victim tracking link  url          age 20d score  12  retire (low score)
as of 2026-12-20
  Phishing domain       domain-name  age 40d score  12  retire (expired)
  Remittance_7731.html  file         age 40d score  44  alert only
  Victim tracking link  url          age 40d score   2  retire (expired)

On 12 November everything blocks. On 30 November, the domain only alerts and the victim link is retired, while the hash still blocks: file hashes rarely cause false positives, so they can live longer. By 20 December the domain has reached its expiry. Retiring an indicator from a blocklist does not delete it: keep it for searches of old logs, where the question is "did this ever happen here?". The half-lives and thresholds are examples; tune yours with sightings and false-positive reports.

08. Common mistakes

09. Check your understanding

Practice check · 3 questions

Markings, exports and decay

Three questions about the bundle and the scripts in this worked example.

Q1. You change the campaign's marking in `build_bundle.py` from TLP:GREEN to TLP:AMBER, then rerun the build and `share.py bundle.json community`. How many objects does the export hold?
Q2. A partner sends you a C2 domain in a report marked TLP:AMBER+STRICT. You would like to add it to your community MISP feed. What may you do?
Q3. On 2026-11-30, `operationalise.py` says the phishing domain is `alert only`, although its `valid_until` is 2026-12-09. Why?
Practice only: not graded, not saved, not evidence.

10. Apply it

For the skill project:

  • Add the packed file from the file-triage lab to the bundle as a second indicator with its SHA-256, an attack-pattern for T1027.002 (Software Packing) and a relationship. Rerun the validator and the export.
  • Add a partner export that allows TLP:AMBER, mark one object TLP:AMBER and check that it appears in the partner file but not in the community file.
  • Run operationalise.py for every Monday of the next three months and write the dates on which each indicator changes action. Compare them with the review dates you chose in From Threat Reports to Defensive Action.

11. Review prompt

Without looking back:

  1. What do STIX, TAXII and TLP each do, and who publishes them?
  2. Name the five TLP 2.0 labels and say how far each may travel.
  3. Why did the lure URL stay out of the community export, and why was the relay IP never in the bundle?
  4. What is the difference between an indicator's expiry date and its decay, and what do you keep after retiring it?

References

Your progress

Reading state

Sign in to save that you finished reading this lesson.

Sign in to mark reading complete

Prove this skill

8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.
Take the skill check