| ID | Technique | Tactic |
|---|---|---|
| T1555 | Credentials from Password Stores | Credential Access |
Detection: MCP Postgres Suspicious Query
Description
This detection identifies potentially malicious SQL queries executed through MCP PostgreSQL server connections, monitoring for privilege escalation attempts, credential theft, and schema reconnaissance. These patterns are commonly observed in SQL injection attacks, compromised application credentials, and insider threat scenarios targeting database assets.
Search
1`mcp_server` method=query direction=inbound
2
3| eval dest=host
4
5| eval query_lower=lower('params.query')
6
7| eval suspicious_query='params.query'
8
9| eval is_priv_escalation=if(like(query_lower, "%update%users%role%admin%") OR like(query_lower, "%grant%admin%") OR like(query_lower, "%grant%superuser%"), 1, 0)
10
11| eval is_credential_theft=if(like(query_lower, "%password%") OR like(query_lower, "%credential%") OR like(query_lower, "%api_key%") OR like(query_lower, "%secret%"), 1, 0)
12
13| eval is_recon=if(like(query_lower, "%information_schema%") OR like(query_lower, "%pg_catalog%") OR like(query_lower, "%pg_tables%") OR like(query_lower, "%pg_user%"), 1, 0)
14
15| where is_priv_escalation=1 OR is_credential_theft=1 OR is_recon=1
16
17| eval attack_type=case(
18 is_priv_escalation=1, "Privilege Escalation",
19 is_credential_theft=1, "Credential Theft",
20 is_recon=1, "Schema Reconnaissance",
21 1=1, "Unknown")
22
23| stats count min(_time) as firstTime max(_time) as lastTime values(suspicious_query) as suspicious_queries values(attack_type) as attack_types dc(attack_type) as attack_diversity by dest
24
25| `security_content_ctime(firstTime)`
26
27| `security_content_ctime(lastTime)`
28
29| table dest firstTime lastTime count suspicious_queries attack_types attack_diversity
30
31| `mcp_postgres_suspicious_query_filter`
Data Source
| Name | Platform | Sourcetype | Source |
|---|---|---|---|
| MCP Server | Other | 'mcp:jsonrpc' |
'mcp.log' |
Macros Used
| Name | Value |
|---|---|
| mcp_server | (sourcetype="mcp:jsonrpc") |
| mcp_postgres_suspicious_query_filter | search * |
mcp_postgres_suspicious_query_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.
Annotations
Default Configuration
This detection is configured by default in Splunk Enterprise Security to run with the following settings:
| Setting | Value |
|---|---|
| Disabled | true |
| Cron Schedule | 0 * * * * |
| Earliest Time | -70m@m |
| Latest Time | -10m@m |
| Schedule Window | auto |
| Creates Risk Event | False |
Implementation
Install the MCP Technology Add-on from https://splunkbase.splunk.com/app/8377 and ensure MCP PostgreSQL server logging is enabled and forwarding to the right index with proper params.query field extraction. Schedule the search to run every 5-15 minutes and configure alerting thresholds based on your environment.
Known False Positives
Legitimate database administrators performing user management tasks, ORM frameworks querying information_schema for schema validation, password reset functionality, and CI/CD pipelines running database migrations.
Associated Analytic Story
References
-
https://www.nodejs-security.com/blog/the-tale-of-the-vulnerable-mcp-database-server
-
https://www.splunk.com/en_us/blog/security/securing-ai-agents-model-context-protocol.html
Detection Testing
| Test Type | Status | Dataset | Source | Sourcetype |
|---|---|---|---|---|
| Validation | ✅ Passing | N/A | N/A | N/A |
| Unit | ✅ Passing | Dataset | mcp.log |
mcp:jsonrpc |
| Integration | ✅ Passing | Dataset | mcp.log |
mcp:jsonrpc |
Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI.
Alternatively you can replay a dataset into a Splunk Attack Range
Source: GitHub | Version: 1