fix: [lastline_api] fix MITRE ATT&CK galaxy tag operand order - #877
Open
elhoim wants to merge 1 commit into
Open
fix: [lastline_api] fix MITRE ATT&CK galaxy tag operand order#877elhoim wants to merge 1 commit into
elhoim wants to merge 1 commit into
Conversation
_get_mitre_techniques() built the misp-galaxy:mitre-attack-pattern tag as
"{id} - {name}" from (id, name) tuples, whereas the established convention
used elsewhere in the codebase (joe_parser.py) and by the MISP galaxy
cluster values themselves is "{name} - {id}". With the operands reversed,
every MITRE technique tag Lastline produces fails to match any galaxy
cluster, so the tag is imported as a plain string rather than resolving
to the corresponding ATT&CK pattern.
Verified with py_compile and the full pytest suite against a live
modules server on port 6763: 160 passed, 4 skipped, 5 subtests passed,
1 failed (test_macvendors, HTTP 429 rate limit from the third-party
MacVendors API, unrelated to this change and reproduced in isolation
as a pass when run alone).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018dfYpyaSZd1nxSRLr8suj8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The defect
LastlineResultBaseParser._get_mitre_techniques()inmisp_modules/lib/lastline_api.pybuilt the MITRE ATT&CK galaxy tag with the operands in the wrong order:wis(id, name), so this produced tags likemisp-galaxy:mitre-attack-pattern="T1134 - Access Token Manipulation"— id first, name second. Every other MITRE ATT&CK galaxy tag built in this repository uses the opposite order,"name - id"(seemisp_modules/lib/joe_parser.py:125), which matches the actual cluster value name in themisp-galaxy:mitre-attack-patterngalaxy.Impact
Because the tag string didn't match any real galaxy cluster value, MISP could not resolve it to the corresponding MITRE ATT&CK galaxy cluster. An analyst enriching a sample via the Lastline module would get a tag attached to the event that looks like a MITRE technique reference but silently fails to link to the galaxy cluster in the UI — no cluster metadata, no navigation to the technique, no consistency with tags produced by other enrichment modules (e.g. Joe Sandbox) for the same techniques.
The fix
Swapped the format operands so the tag is built as
"{name} - {id}", matching the convention used elsewhere in the codebase (joe_parser.py) and the format MISP'smitre-attack-patterngalaxy actually expects.No behaviour change beyond correcting the tag string — this is a straightforward bug fix, not a change of default or contract.
Verification
python -m py_compile misp_modules/lib/lastline_api.py— clean (this file is undermisp_modules/lib/and is excluded from flake8 per this repo's CI convention).1 failed, 160 passed, 4 skipped, 5 subtests passed in 22.69s. The one failure,test_macvendors, is an HTTP 429 rate limit from the third-party MacVendors API, unrelated to this change; re-running it in isolation passed. There is no dedicated test file exercisinglastline_api.pyor_get_mitre_techniques()intests/(confirmed by search), so the full-suite pass with only that unrelated failure is the available verification.Found during a review of the repository; other findings are being submitted as separate PRs.
🤖 Generated with Claude Code
https://claude.ai/code/session_018dfYpyaSZd1nxSRLr8suj8