Skip to content

MCP tools that act on remote hosts are labelled as local activity, and an offensive MCP server is not recognised #436

Todo

Description

@blitzcrieg1

Context

jm33-m0/emp3r0r (about 1.8k stars, GPL-3.0, v5.9.0 on 2026-11-15) is a post-exploitation C2. Its emp3r0r mcp command exposes the operator surface as a stdio MCP server, and its README names Claude Code and Codex as the clients: the coding agent selects targets, runs modules, moves files and builds agents in natural language. Tools include ls, cat, cp, mv, rm, mkdir, ps, kill, socks_start, list_agents, read_job_output and module execution (core/internal/cc/mcp/).

So "a coding agent on a laptop attached to an offensive MCP server" is an off-the-shelf setup. Agentmetry would record those calls through the hooks or the MCP proxy. Two gaps follow. Neither was reproduced against a running emp3r0r; this is from its source and README.

1. Remote-acting tools read as local activity

emp3r0r's file tools take a path that names a file on the compromised target. With the location-key rule on the detection-pass branch (#435), mcp__emp3r0r__cat {"path": "/root/.ssh/id_rsa"} is tagged T1552.004 as a private-key read, and mcp__emp3r0r__rm {"path": ...} counts toward a deletion burst, both as if they happened on the recording machine. The record is useful; the meaning is wrong. Nothing in the event says the action ran somewhere else, and the tool cannot tell local from remote.

The same applies to any MCP server that operates on remote systems (SSH, cloud shells, remote desktops). Possible direction: an event field or trait for "acts on a remote target", set from a small list of known remote-acting servers or from the proxy's server config, and rules that keep remote and local evidence apart.

2. An offensive MCP server attached to an agent is not recognised

Nothing flags that an agent's MCP config, or its live tool calls, names a known C2 or offensive framework. agentmetry scan reads agent configs and could report it, and a live detection could fire on mcp__emp3r0r__* tool names or an emp3r0r mcp server command. This belongs to the MCP fingerprinting backlog.

Status

Feature work under the maintenance rule. Filed so the case is on record for the detection pass or a request from a named person. Not for 0.13.0.

🤖 Generated with Claude Code

Activity

  1. added
    enhancement
    detection-rule
    on Nov 15, 2026
  2. added
    bounty
    on Nov 24, 2026
  3. TassioSales commented on Nov 24, 2026

    @TassioSales

    Proposal to Address Issue #436: MCP Remote Activity and Offensive Server Recognition

    I am writing to formally claim and commit to implementing the necessary changes to address Issue #436. This issue highlights critical gaps in Agentmetry's ability to accurately represent and detect activity originating from remote hosts via MCP servers, specifically in the context of post-exploitation frameworks like emp3r0r. I believe a robust solution will significantly enhance Agentmetry's fidelity and detection capabilities.

    Technical Breakdown

    1. Root Cause / Technical Assessment

    The core of the problem lies in Agentmetry's current event generation and rule processing, which implicitly assume local execution for all MCP-driven actions.

    • Issue 1 (Remote Activity Misattribution): MCP tools like emp3r0r mcp's file manipulation commands (cat, rm, cp, mv) operate on paths specified on the remote target. Agentmetry, by default, records these actions without an explicit indicator of their remote origin. This leads to misattribution, where remote file operations are incorrectly classified as local, potentially skewing detection logic (e.g., deletion bursts) and obscuring the true scope of an operation. The lack of a distinct field or trait to denote remote action is the primary technical deficiency.
    • Issue 2 (Offensive MCP Server Recognition): Agentmetry currently lacks a mechanism to identify or flag MCP servers that are known to be part of offensive frameworks. This means that even when Agentmetry is observing traffic from a tool like emp3r0r, it cannot inherently recognize the server as malicious or part of a C2 infrastructure. This is a gap in "MCP fingerprinting."

    2. Proposed Architecture and Code Change Plan

    My approach will focus on introducing explicit metadata for remote actions and implementing a fingerprinting mechanism for known offensive MCP servers.

    For Issue 1: Remote Activity Recognition

    • Introduction of target_type Trait: I propose introducing a new trait, target_type, to Agentmetry events. This trait will have enumerated values such as local and remote.
    • MCP Proxy Configuration: The agentmetry-proxy will be extended to accept a configuration parameter (e.g., remote_servers or target_type_mapping) that maps specific MCP server identifiers (hostnames, IPs, or even specific server handshake patterns) to the remote target_type.
    • Event Augmentation: When an MCP request is proxied, the agentmetry-proxy will inspect the server configuration. If the server is identified as remote, the target_type: remote trait will be added to all subsequent events generated for that session.
    • Rule Adaptation: Existing and new detection rules will be updated to leverage the target_type trait. This will allow for distinct analysis of local vs. remote file operations, command executions, etc. For example, a deletion burst rule could be refined to only trigger on local deletions or to have different thresholds for remote deletions.

    For Issue 2: Offensive MCP Server Recognition

    • MCP Fingerprinting Module: A new module, mcp_fingerprinter, will be developed within Agentmetry.
    • Signature Database: This module will maintain a database of known MCP server signatures. Signatures could include:
      • Specific command patterns (e.g., emp3r0r mcp server initialization messages).
      • Unique header fields or communication protocols observed during the MCP handshake.
      • Known tool names or module paths exposed by the MCP server.
    • Detection Pass Integration:
      • Static Scan (agentmetry scan): The agentmetry scan command will be enhanced to analyze agent configurations for known offensive MCP server endpoints or identifiers.
      • Live Detection: The mcp_fingerprinter will be integrated into the live detection pipeline. When an MCP server is identified (either through proxy configuration or by observing its communication patterns), its signature will be checked against the database. If a match is found, an event or alert will be generated, potentially with a specific MITRE ATT&CK technique mapping (e.g., T1071.004 - Application Layer Protocol: Web Protocols, if the MCP server uses HTTP).
    • EMP3r0r Specifics: For emp3r0r, the initial fingerprinting will target its emp3r0r mcp command and its characteristic communication patterns.

    3. Testing and Verification Approach

    • Unit Tests: Comprehensive unit tests will be written for the mcp_fingerprinter module, covering various signature matching scenarios. Tests for the agentmetry-proxy will verify correct target_type assignment based on configuration.
    • Integration Tests: Integration tests will simulate scenarios involving a local Agentmetry agent, an agentmetry-proxy configured for remote MCP servers, and a mock emp3r0r MCP server. These tests will verify that remote actions are correctly tagged and that the offensive server is identified.
    • Fixtures: Mock MCP server responses and agent configurations will be created as fixtures to facilitate testing.
    • CI Checks: All new code will be subject to the existing CI pipeline, ensuring code quality, style, and passing test suites. The agentmetry scan enhancement will be verified through simulated agent configuration files.

    I am confident that this structured approach will effectively address both aspects of Issue #436, leading to a more accurate and insightful representation of post-exploitation activities within Agentmetry. I am eager to contribute to this enhancement.

    @TassioSales

  4. blitzcrieg1 commented on Nov 24, 2026

    @blitzcrieg1
    OwnerAuthor

    Thanks for volunteering, @TassioSales. I’d be happy to review a small draft PR focused on where an MCP tool acts.

    Please start with an optional per-tool target scope of local, remote, or unknown, sourced from operator configuration. Keep the MCP transport and the target scope separate. A stdio server can act on a remote system, and one server can expose tools with different scopes. Existing events and tools without a configured scope should read as unknown.

    Synthetic fixtures are enough. A good test would cover a single stdio server with both a local and a remote tool, plus a legacy event with no scope field. Keep the original activity visible and make sure the remote fixture is excluded from claims about activity on the recording host.

    Let’s handle known-server fingerprinting in a separate PR. One ATT&CK detail for that follow-up: T1071.004 is DNS and T1071.001 is Web Protocols. We should map only behavior the evidence supports. MITRE ATT&CK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bountydetection-ruleenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions