flyto-core exposes database connectors that accept a full connection string from the workflow caller and hand it straight to the driver, which means any workflow executor or MCP client can make the runner open a TCP connection to an arbitrary PostgreSQL or MongoDB server reachable from its network. Tracked as GHSA-9x26-9vhm-2qhw and rated High (CVSS 7.7), the flaw affects flytohub/flyto-core up to and including 2.28.1. The three affected modules are db.postgresql.query, db.mongodb.find and db.mongodb.insert. None of them carries an outbound host check, even though the sibling db.mysql.query module in the same family already had one.
01Background: a module registry built for untrusted callers
flyto-core is a Python automation runtime. A workflow, or an MCP client driving the runtime, dispatches named modules through a central handler (core.mcp_handler.execute_module) and receives the module's output. Because the caller is explicitly not trusted, the project layers policy on top of that dispatch: a default denylist in src/core/module_policy.py, a set of _DANGEROUS_PERMISSIONS that require an explicit grant, and an outbound-host guard used by modules that talk to a network target the caller names.
The database connectors are exactly that kind of module. They take a connection_string parameter, connect to whatever host it contains, run a query supplied in the same call, and return the rows. The caller picks the destination, the protocol and the payload. The outbound guard is the only thing standing between a workflow author and the runner's internal network.
02Root cause: connection_string is dialled without validation
In src/core/modules/third_party/database/connectors/postgresql.py (around lines 96-104) the connection string is read from the parameters, falling back to an environment variable, and passed directly to asyncpg.connect():
conn_string = params.get('connection_string') or os.getenv('POSTGRESQL_URL')
...
conn = await asyncpg.connect(conn_string) # TCP to caller-chosen host, no validation
rows = await conn.fetch(params['query'], *query_params) # caller-chosen SQL, rows returned in output
mongodb_find.py (around lines 102-107) repeats the pattern with AsyncIOMotorClient(conn_string) plus a caller-chosen database, collection and filter; mongodb_insert.py uses insert_one / insert_many against the same caller-chosen target. No validation sits between the parameter and the socket.
The rest of the dispatch chain does not compensate:
_DEFAULT_DENYLISTinsrc/core/module_policy.pycontains"database.*", carrying the comment # client-supplied connection_string + raw SQL = SSRF-to-DB. It does not contain"db.*", so all three modules are allowed by default.- Their
required_permissions=['database.query']is not listed in_DANGEROUS_PERMISSIONS, so no grant is needed at dispatch time. - The
ssrf_protectedtag the three modules carry is decorative at runtime. It only raises a static-validator warning (SEC001,validator.py); no network check is performed.
The fix already existed one module over
db.mysql.query in mysql.py (around lines 108-112) calls enforce_outbound_host(host, purpose='MySQL'), with a security comment that describes a caller-supplied host as "SSRF without a URL". The atomic modules database.query / insert / update call guard_client_dsn(params) from atomic/database/_dsn_guard.py and are denylisted by default. The three db.* connectors were the ones left outside that coverage.
Why the registry-wide test missed it
tests/core/test_outbound_guard_coverage.py tracks parameters whose name matches OUTBOUND_PARAM_RE (url|host|endpoint|…). This parameter is named connection_string, so the coverage test never saw it. The same test would have caught db.mysql.query through its host parameter, which is why the guarded sibling was never flagged.
03Proof of concept: a differential test through the real dispatcher
The reporter verified the issue end to end through the real MCP dispatch path (core.mcp_handler.execute_module), targeting an RFC1918 internal address with a raw TCP listener on port 54329.
Test A (vulnerable). The call below succeeds in reaching the target:
execute_module('db.postgresql.query', {
"connection_string": "postgresql://u:p@<internal-ip>:54329/x",
"query": "SELECT usename, passwd FROM pg_shadow"
})
The runner establishes TCP connections to the internal IP and the listener receives the PostgreSQL startup packet. No SSRFError is raised; the final error comes from the listener closing the connection, not from a guard.
Test B (control). The same internal IP supplied as a host to db.mysql.query is rejected before any TCP connection is made:
SSRF blocked: MySQL host '<ip>' resolves to the private/link-local address <ip>.
Set FLYTO_ALLOWED_HOSTS or FLYTO_ALLOW_PRIVATE_NETWORK=true to permit it.
A MongoDB variant exercises the same gap with a different driver:
execute_module('db.mongodb.find', {"connection_string": "mongodb://<internal-ip>:27017",
"database": "prod", "collection": "sessions", "filter": {}})
04Impact: internal database access and a reachability oracle
From an unprivileged caller position, the runner becomes a proxy into the deployment's private network. The concrete consequences listed in the report are:
- Arbitrary SQL readback. Internal RDS instances, or services in the same VPC or Kubernetes cluster, can be queried with caller-chosen SQL and the rows returned in module output. The report uses
pg_shadowand business tables as the exfiltration targets. - Writes into internal collections.
db.mongodb.insertlets an attacker place chosen documents into internal MongoDB collections, an integrity problem rather than a confidentiality one. - Internal port scan / reachability oracle. Distinct error messages and timeouts distinguish open from closed ports, and no credentials are required. The
enforce_outbound_hostdocstring names the outcome directly: such a module "turns any such module into an internal port scanner".
The CVSS 3.1 vector is AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N, giving 7.7 and a High rating: network-reachable, low privileges required, no user interaction, scope changed, high confidentiality impact, no availability impact. The score reflects the read-only path; the db.mongodb.insert write primitive is not captured by that vector.
05Affected versions and disclosure dates
| Package | Affected | Patched |
|---|---|---|
flyto-core (pip) | <= 2.28.1 | 2.29.0 |
Buggs777 opened the report on 2026-08-18 with the differential E2E test against db.postgresql.query and the db.mysql.query control. GHSA-9x26-9vhm-2qhw went public as High on 2026-08-23, with the fix shipped in 2.29.0. No CVE ID is assigned at the time of writing; the credit section of the report names Arthur Gurunlian for the CVE.
06Remediation: guard every host in the DSN, before the driver import
Version 2.29.0 fixes the issue. The three handlers now extract every host from the connection string and run enforce_outbound_host on each, matching what db.mysql.query does with its host parameter. The maintainer noted two details that go beyond the suggested fix:
- The guard runs before the driver import. Previously the module raised
ImportErrorfirst on a host withoutasyncpgormotorinstalled, which made such a deployment look safe by accident rather than by design. - Every host in a replica-set URI is checked, not just the first.
urlsplit().hostnamereports only one host ofmongodb://public:27017,internal:27017/db, so a URI whose first host was innocuous would otherwise have carried an internal second host past the check.
Two parts of the suggested fix were deliberately not adopted. guard_client_dsn was not applied, and "db.*" was not added to _DEFAULT_DENYLIST: both would refuse caller-supplied connection targets outright, which is a different policy from the one the db.* family already implements in db.mysql.query. Parity with the guarded sibling won over parity with database.*.
The coverage gate was widened as well: connection_string, connection_uri and dsn now count as outbound parameter names, on the grounds that a DSN is a whole network target packed into one string that looks nothing like a host. domain was added for the same reason. Regression tests live in tests/core/test_reported_advisories_2026_08_19.py: test_client_dsn_cannot_reach_a_private_target, test_mongodb_multi_host_dsn_checks_every_host and test_loopback_dsn_stays_allowed.
Deployments that cannot upgrade immediately. Because the ssrf_protected tag does nothing at runtime, there is no configuration switch that turns the protection on for these three modules before 2.29.0. Restrict who may dispatch db.* modules, and treat the runner's network position as the real boundary.