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
On this page
- The problem
- Step 1: Install the libraries
- Step 2: Define the TLP 2.0 markings
- Step 3: Build the bundle
- Step 4: Validate the bundle, and check the validator
- Step 5: Export only what an audience may receive
- Step 6: Let indicators decay in your own controls
- Common mistakes
- Check your understanding
- Apply it
- Review prompt
Lessons of Threat Intel & Malware Triage
- From Threat Reports to Defensive Action Concept · 20 min
- Working a Reported Phishing Email Lab · 30 min
- Safe First Look at a Suspicious File Lab · 30 min
- Email Authentication from Monitor to Reject Worked example · 20 min
- Sharing and Operationalising Indicators Worked example · 20 min
- Threat Intel & Malware Triage Check Knowledge check · 8 questions
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.
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'stix2 3.0.2
stix2-patterns 2.1.2
stix2-validator 3.3.203. 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.
"""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.
"""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").venv/bin/python build_bundle.pyidentity 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.jsonEach 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.
"""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).venv/bin/python validate.py bundle.jsonbundle.json: valid=True
warning in attack-pattern: {302} External reference 'mitre-attack' has a URL
but no hash.sed "s/= 'northwind-pay.test'/= northwind-pay.test/" bundle.json > broken.json
.venv/bin/python validate.py broken.json; echo "exit=$?"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=1The 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.
"""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)}").venv/bin/python share.py bundle.json community
grep -c 'u=amy.lee' share-community.json || echo "no victim link in the export"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 exportThe 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.
"""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}")for day in 2026-11-12 2026-11-30 2026-12-20; do
.venv/bin/python operationalise.py bundle.json $day
doneas 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
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-patternfor T1027.002 (Software Packing) and a relationship. Rerun the validator and the export. - Add a
partnerexport 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.pyfor 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:
- What do STIX, TAXII and TLP each do, and who publishes them?
- Name the five TLP 2.0 labels and say how far each may travel.
- Why did the lure URL stay out of the community export, and why was the relay IP never in the bundle?
- 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.
Prove this skill
8 questions · about 6 minutes · scored automatically. Marking a lesson as read never demonstrates a skill.