[threat-actor-enrichment] Add connector to fix stale last_seen on threat actor groups#6044
Open
MrStarkEG wants to merge 5 commits intoOpenCTI-Platform:masterfrom
Open
[threat-actor-enrichment] Add connector to fix stale last_seen on threat actor groups#6044MrStarkEG wants to merge 5 commits intoOpenCTI-Platform:masterfrom
MrStarkEG wants to merge 5 commits intoOpenCTI-Platform:masterfrom
Conversation
…eat actor groups Adds a new external-import connector that periodically computes the real last_seen date for threat actor groups from related indicators and reports. Reads Elasticsearch via aggregations for performance, writes back through the OpenCTI GraphQL API (fieldPatch) for proper cache/stream/audit handling. Traverses threat actor -> malware (rel_uses) -> indicators (rel_indicates) and reports (rel_object) to find the most recent activity date. Only updates forward (never moves last_seen backward), skips entities already current. Addresses: OpenCTI-Platform/opencti#9385
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.
Proposed changes
last_seendate for threat actor groups from related indicators and reportsfieldPatch) for proper cache/stream/audit handlingrel_uses) → indicators (rel_indicates) and reports (rel_object) to find the most recent activity datelast_seenbackward), skips entities that are already currentRelated issues
Checklist
Further comments
OpenCTI treats
last_seenon threat actors as a static STIX property that only updates when the entity itself is re-imported with a newer value. New indicators and reports linked to a threat actor's malware don't propagate their dates back to the actor, so active groups can showlast_seenmonths or years behind their actual activity.This connector runs on a configurable interval (default 24h), scans all
threat-actor-groupentities, and updates any stalelast_seenvalues. It uses Elasticsearch direct queries for fast bulk reads (aggregations across indicators/reports) and the OpenCTI GraphQL API for writes, following the established pattern where external components use the API layer for mutations.Tested against OpenCTI 7.260318.0 with Elasticsearch 8.19.9. The connector:
EXTERNAL_IMPORTwithOpenCTIConnectorHelperlast_seenfrom indicators (valid_from) and reports (published)run_and_terminatemodehelper.get_state()/set_state()