mcp-server-semgrep
Version:
MCP Server for Semgrep Integration - static code analysis with AI
46 lines (45 loc) • 1.49 kB
YAML
rules:
- id: io-source-ssrf
patterns:
- pattern-either:
- pattern: Source.fromURL($URL,...)
- pattern: Source.fromURI($URL,...)
- pattern-inside: |
import scala.io.$SOURCE
...
- pattern-either:
- pattern-inside: |
def $FUNC(..., $URL: $T, ...) = $A {
...
}
- pattern-inside: |
def $FUNC(..., $URL: $T, ...) = {
...
}
message: >-
A parameter being passed directly into `fromURL` most likely lead to SSRF.
This could allow an attacker to send data to their own server, potentially exposing sensitive data
sent with this request.
They could also probe internal servers or other resources that the server running this code can access.
Do not allow arbitrary hosts. Instead, create an allowlist for approved hosts, or hardcode the correct
host.
metadata:
cwe:
- 'CWE-918: Server-Side Request Forgery (SSRF)'
owasp:
- A10:2021 - Server-Side Request Forgery (SSRF)
references:
- https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html
- https://www.scala-lang.org/api/current/scala/io/Source$.html#fromURL(url:java.net.URL)(implicitcodec:scala.io.Codec):scala.io.BufferedSource
category: security
technology:
- scala
confidence: MEDIUM
cwe2022-top25: true
cwe2021-top25: true
subcategory:
- audit
likelihood: LOW
impact: HIGH
languages: [scala]
severity: WARNING