Skip to main content

Security Scanning: Find Vulnerabilities in Running Databases

Security vulnerabilities in your database are difficult to predict and track. They can be found in GRANTs, extensions, and even authentication methods. Thankfully, common vulnerabilities and exposures (CVEs) have been compiled into a standardized framework with severity scores, which Atlas uses in the Security Graph to automatically identify and rank CVEs in your databases.

With the atlas security scan command, you can access this information in the CLI on demand. Atlas connects to your database and reports the security issues found. The cve check is included by default. It resolves the server version of each database, and the extensions installed in it, against the Security Graph. It reports those affected by a published CVE, each with its severity level and the suggested fix.

The scan reads the live database, not a schema file or a migration directory, so it needs neither a dev database nor access to your codebase. Run scheduled scans against staging and production to catch CVEs published for versions that are already installed, and use the cve analyzer in CI to catch a vulnerable extension before it is installed.

atlas security scan and the security block are available to Atlas Pro users with the Security Graph enabled in their plan. Run the following command to use this feature:

atlas login

Scanning a Database​

Point the scanner at a database with --url:

atlas security scan --url "clickhouse://default:pass@localhost:9000"

Each finding names the engine or the extension it was reported for and its version, followed by the CVE identifier, its severity level, the title of the record (when it has one), and the version to upgrade to. Credentials are redacted from the report, so it is safe to keep in CI logs or forward to a webhook.

Scanning 1 database for security issues:

-- clickhouse://default:xxxxx@localhost:9000 (clickhouse 23.10.5.20):
-- Engine "clickhouse" version "23.10.5.20" is vulnerable to CVE-2024-22412 (ELEVATED):
ClickHouse's Role-based Access Control is bypassed when query caching is enabled. Upgrade
database engine "clickhouse" to version 23.12.6.19 or later to resolve CVE-2024-22412
-- Engine "clickhouse" version "23.10.5.20" is vulnerable to CVE-2026-116366 (CRITICAL):
Unauthenticated RCE vulnerability against ClickHouse Server. Upgrade database engine
"clickhouse" to version 26.3.62.3 or later to resolve CVE-2026-116366

-------------------------
-- 409.516708ms
-- 2 issues found: 1 critical, 1 elevated

The server version is matched against the CVEs published for the engine, so a server is reported until it runs a release that carries the fix. Upgrading the server above to 26.3.62.3 resolves both findings.

Engines and extensions​

The cve check covers the following engines:

EngineChecked
PostgreSQLThe server version and the installed extensions
MySQL, MariaDBThe server version
ClickHouseThe server version
SQL ServerThe server version

MariaDB is told apart from MySQL by its server version, so a MariaDB server behind a mysql:// URL is matched against the CVEs of MariaDB. SQL Server ships each fix twice, in a build of the GDR branch and in a build of the cumulative update (CU) branch, and a server is matched against the fix of its own branch. A server on a GDR build is told to upgrade to a later GDR build, and one on a CU build to a later build of the CU branch, such as the security update released on top of its CU.

Azure SQL Database is not checked. It reports version 12.0.2000.8, the RTM build of SQL Server 2014, whatever it runs, so a SQL Server 2014 server still on that build is not reported either.

On other engines, such as SQLite, the server version is not matched against any CVE. The scan succeeds and reports no issues, so a scan can be pointed at a mixed fleet without special casing. On these engines, the line no issues found in the server version does not mean the version was checked.

On PostgreSQL, the scan checks the extensions installed in the database too:

atlas security scan --url "postgres://postgres:pass@localhost:5432/app?sslmode=disable"
Scanning 1 database for security issues:

-- postgres://postgres:xxxxx@localhost:5432/app?sslmode=disable (postgres 18.6):
-- Extension "vector" version "0.8.5" is vulnerable to CVE-2026-103484 (HIGH): pgvector
buffer overflow in IVFFlat index build. Upgrade extension "vector" to version 0.8.7 or
later to resolve CVE-2026-103484
-- Extension "vector" version "0.8.5" is vulnerable to CVE-2026-18022 (HIGH): pgvector
buffer overflow via integer wraparound in IVFFlat index build on 32-bit systems. Upgrade
extension "vector" to version 0.8.6 or later to resolve CVE-2026-18022

-------------------------
-- 864.441209ms
-- 2 issues found: 2 high

An extension is matched by the version its fixes ship in:

ExtensionMatched againstIts findings name
Versioned on its own, such as vector (pgvector)Its installed versionAn extension upgrade
Built into the engine, such as hstore or pgcryptoThe server versionAn engine upgrade

A CVE of a built-in extension is reported for the engine while the extension is not installed, and for the extension once it is, as with pg_trgm. An extension installed in pg_catalog, such as plperl, is not inspected, so its CVEs are always reported for the engine. Extensions are read at the database level, so a URL bound to a single schema still reports every extension installed in that database.

To match CVEs, Atlas sends the Security Graph the engine, its version, and the names and versions of the installed extensions.

Clean databases​

A database with nothing to report says so. Once vector is upgraded to 0.8.7, the scan above reports:

Scanning 1 database for security issues:

-- postgres://postgres:xxxxx@localhost:5432/app?sslmode=disable (postgres 18.6):
-- no issues found in the server version and 4 extensions

-------------------------
-- 880.933334ms
-- no issues found

The count is the extensions Atlas inspected, so an extension installed in pg_catalog, such as plpgsql, is not among them. On an engine without extensions, the line reads no issues found in the server version.

Scanning multiple databases​

Pass --url more than once, or as a comma-separated list, to scan several databases in one run. A database that could not be reached is reported with the rest instead of ending the scan:

atlas security scan \
--url "postgres://postgres:pass@localhost:5432/app?sslmode=disable" \
--url "clickhouse://default:pass@localhost:9000" \
--url "postgres://postgres:pass@localhost:5433/reporting?sslmode=disable"
Scanning 3 databases for security issues:

-- postgres://postgres:xxxxx@localhost:5432/app?sslmode=disable (postgres 18.6):
-- Extension "vector" version "0.8.5" is vulnerable to CVE-2026-103484 (HIGH): pgvector
buffer overflow in IVFFlat index build. Upgrade extension "vector" to version 0.8.7 or
later to resolve CVE-2026-103484
-- Extension "vector" version "0.8.5" is vulnerable to CVE-2026-18022 (HIGH): pgvector
buffer overflow via integer wraparound in IVFFlat index build on 32-bit systems. Upgrade
extension "vector" to version 0.8.6 or later to resolve CVE-2026-18022

-- clickhouse://default:xxxxx@localhost:9000 (clickhouse 23.10.5.20):
-- Engine "clickhouse" version "23.10.5.20" is vulnerable to CVE-2024-22412 (ELEVATED):
ClickHouse's Role-based Access Control is bypassed when query caching is enabled. Upgrade
database engine "clickhouse" to version 23.12.6.19 or later to resolve CVE-2024-22412
-- Engine "clickhouse" version "23.10.5.20" is vulnerable to CVE-2026-116366 (CRITICAL):
Unauthenticated RCE vulnerability against ClickHouse Server. Upgrade database engine
"clickhouse" to version 26.3.62.3 or later to resolve CVE-2026-116366

-- postgres://postgres:xxxxx@localhost:5433/reporting?sslmode=disable:
-- postgres: querying system variables: dial tcp [::1]:5433: connect: connection refused

-------------------------
-- 1.061387208s
-- 1 database could not be scanned
-- 4 issues found: 1 critical, 2 high, 1 elevated

A target that failed before its connection was opened carries no driver or version, which is why the third target above shows the URL alone.

Failing the Command​

The command exits with a non-zero status when a database could not be scanned, as that leaves its state unknown. The report already names the target and the reason, so nothing more is printed. The footer of the three-database scan above is the whole signal:

  -------------------------
-- 1.061387208s
-- 1 database could not be scanned
-- 4 issues found: 1 critical, 2 high, 1 elevated

The issues it reports do not fail it, as that run exits non-zero for the unreachable database, not for the four findings.

To gate on findings, set the lowest severity an issue must reach, either with --fail-on or with fail_on in the security block:

atlas security scan --url "postgres://postgres:pass@localhost:5432/app?sslmode=disable" --fail-on HIGH

An issue at HIGH or CRITICAL now exits non-zero, again with no output beyond the report. This keeps reporting separate from gating: a scheduled scan reports everything it finds while only HIGH and above break the build.

Severity Levels​

The scan grades findings on the level the Security Graph assigns them, from lowest to highest:

NORMAL, ELEVATED, HIGH, CRITICAL

Filter the report with --min-severity, and drop individual records with --ignore. Both severity flags are case-insensitive:

atlas security scan --url "clickhouse://default:pass@localhost:9000" --min-severity HIGH
atlas security scan --url "postgres://postgres:pass@localhost:5432/app?sslmode=disable" --ignore "CVE-2026-18022"

The CVSS (Common Vulnerability Scoring System) rating of the underlying record stays available in the output as Severity, alongside the level the scan grades on. The two differ: a record the CVSS rated below HIGH, or did not rate at all, is graded ELEVATED, so it is reported rather than dropped. CVE-2024-22412 above is rated LOW and graded ELEVATED.

note

security.cve grades on the Security Graph level, while the min_severity of the lint.cve analyzer grades on the CVSS rating (LOW, MEDIUM, HIGH, CRITICAL). The two blocks are configured separately, and the lint policy does not filter the scan.

Configuration​

A security block in the atlas.hcl file configures the scan. Each check has its own block and runs when that block is present, and the cve check is included by default, so a security block with no check block still runs it:

atlas.hcl
env "prod" {
url = "postgres://postgres:pass@localhost:5432/app?sslmode=disable"
security {
min_severity = ELEVATED
fail_on = HIGH
cve {
// Affects 32-bit systems only.
ignore = ["CVE-2026-18022"]
}
}
}
atlas security scan --env prod

The url of the selected env is the database the scan runs against, so --url can be omitted. The exclude patterns of the env apply to the inspection the scan runs, so a pattern that hides an extension versioned on its own, such as vector, hides its findings too. A CVE of a hidden built-in extension, such as pgcrypto, is reported for the engine instead, as if the extension were not installed. The findings of the server version are reported regardless.

The security block takes the following attributes:

AttributeDescription
min_severityThe lowest level every check reports: NORMAL, ELEVATED, HIGH or CRITICAL. A check raises it for itself by setting its own, and never lowers it. All findings are reported when unset.
fail_onFail the command when an issue of this level or higher was reported. Issues are reported without failing the command when unset.

The flags take precedence over the block: --min-severity replaces the level shared by every check, and --fail-on replaces the configured one. --ignore is added to the identifiers the cve check already ignores rather than replacing them.

The cve check​

The cve check reports the server version and the installed extensions with known vulnerabilities, as recorded in the Atlas Security Graph:

atlas.hcl
security {
cve {
min_severity = HIGH
ignore = ["CVE-2026-18022"]
timeout = "10s"
}
}
AttributeDescription
min_severityThe lowest level this check reports. It applies when higher than the one the security block sets for every check.
ignoreCVE identifiers that are not reported.
timeoutTime limit for querying the Security Graph, 5s by default. A Security Graph that did not answer fails the scan rather than reporting a clean database.

The level a check reports at is the higher of its own min_severity and the one the security block sets for every check. In the following configuration, HIGH applies to the cve check and ELEVATED applies to any other check that is added:

atlas.hcl
security {
min_severity = ELEVATED
cve {
min_severity = HIGH
}
}

Project-level and env-level blocks​

The block may be defined at the project level, inside an env, or both. An env block inherits the project one attribute by attribute, and the notify block is inherited as a whole:

atlas.hcl
security {
fail_on = HIGH
cve {
min_severity = ELEVATED
}
}

env "prod" {
url = "postgres://postgres:pass@localhost:5432/app?sslmode=disable"
// Inherits fail_on and cve.min_severity, and replaces the ignore list.
security {
cve {
ignore = ["CVE-2026-18022"]
}
}
}

Notifications​

A notify block sends the result of the scan to HTTP endpoints, such as a Slack webhook:

atlas.hcl
variable "slack_webhook" {
type = string
}

env "prod" {
url = "postgres://postgres:pass@localhost:5432/app?sslmode=disable"
security {
notify {
on = [FINDINGS, FAILURE]
http "slack" {
url = var.slack_webhook
headers = { "Content-Type" = "application/json" }
body = jsonencode({
text = "${scan.count} issues (${scan.critical} critical, ${scan.high} high, ${scan.elevated} elevated)"
})
}
}
}
}

The on attribute selects the events the result is sent on. It defaults to [FINDINGS, FAILURE], the events worth waking someone up for, so a clean scan sends nothing:

EventSent when
FINDINGSThe scan reported at least one issue.
FAILUREA database could not be scanned.
ALWAYSEvery scan, including a clean one.

A notify block requires at least one http block. The block may be repeated to notify more than one endpoint, and takes an optional name that Atlas uses when reporting an endpoint that failed:

Error: security.notify.http "slack": unexpected status 404: no such hook
AttributeDescription
urlThe URL for the request. Required. Supported schemes are http and https.
methodPOST (default), PUT or PATCH.
headersA map of request header field names and values.
bodyThe request body.
request_timeout_msThe request timeout in milliseconds, 10000 by default.
retryA block with attempts, min_delay_ms and max_delay_ms. attempts counts retries after the first try, and there are none by default.
ca_cert_pemCertificate Authority in PEM format.
client_cert_pemClient certificate in PEM format. Requires client_key_pem.
client_key_pemClient key in PEM format. Requires client_cert_pem.
insecureSkip verification of the server certificate chain and hostname. false by default.

The scan scope​

The url, headers and body of an http block may interpolate the result of the scan:

ReferenceDescription
scan.countTotal number of issues reported.
scan.critical, scan.high, scan.elevated, scan.normalNumber of issues reported at each level. Always present, 0 included.
scan.failuresNumber of databases that could not be scanned.
scan.reportThe default report, without terminal styling.
scan.targetsThe scanned databases, each with url, driver, version, error, extensions and vulnerabilities.

Each entry of vulnerabilities holds id, name, engine, version, level, severity, title, description, suggestion, and text for the line the default report prints. A finding of the server version sets engine and leaves name empty. scan.targets is indexed, so a single-database scan reads its target as scan.targets[0].url. Forwarding the whole report is a single attribute:

atlas.hcl
notify {
on = [ALWAYS]
http {
url = var.slack_webhook
body = jsonencode({ text = scan.report })
}
}

Endpoints are notified in the order they are declared, before the command decides its exit code, so a scan that fails on fail_on or on an unreachable database still sends its notification. An endpoint that errors, or answers with a status outside the 2xx range, stops the remaining ones and fails the command with that error in place of the scan verdict, so keep retry on an endpoint whose availability should not decide the outcome of a scan.

Output Formats​

--format renders the result with a Go template. There is no json shorthand: the json template function marshals whatever it is given, and a second argument indents it.

atlas security scan \
--url "postgres://postgres:pass@localhost:5432/app?sslmode=disable" \
--url "clickhouse://default:pass@localhost:9000" \
--min-severity HIGH --format '{{ json . " " }}'
{
"Targets": [
{
"URL": "postgres://postgres:xxxxx@localhost:5432/app?sslmode=disable",
"Driver": "postgres",
"Version": "18.6",
"Extensions": [
"hstore",
"pg_trgm",
"pgcrypto",
"vector"
],
"Vulnerabilities": [
{
"Name": "vector",
"Version": "0.8.5",
"ID": "CVE-2026-103484",
"Level": "HIGH",
"Severity": "HIGH",
"Title": "pgvector buffer overflow in IVFFlat index build",
"Description": "IVFFlat index build in pgvector before 0.8.7 allows a database user to write data out-of-bounds, which can lead to arbitrary code execution.",
"Suggestion": "Upgrade extension \"vector\" to version 0.8.7 or later to resolve CVE-2026-103484"
},
{
"Name": "vector",
"Version": "0.8.5",
"ID": "CVE-2026-18022",
"Level": "HIGH",
"Severity": "HIGH",
"Title": "pgvector buffer overflow via integer wraparound in IVFFlat index build on 32-bit systems",
"Description": "Integer wraparound in IVFFlat index build in pgvector before 0.8.6 allows a database user to write data out-of-bounds, which could lead to arbitrary code execution. Only 32-bit systems are affected.",
"Suggestion": "Upgrade extension \"vector\" to version 0.8.6 or later to resolve CVE-2026-18022"
}
]
},
{
"URL": "clickhouse://default:xxxxx@localhost:9000",
"Driver": "clickhouse",
"Version": "23.10.5.20",
"Vulnerabilities": [
{
"Engine": "clickhouse",
"Version": "23.10.5.20",
"ID": "CVE-2026-116366",
"Level": "CRITICAL",
"Severity": "CRITICAL",
"Title": "Unauthenticated RCE vulnerability against ClickHouse Server",
"Description": "An issue has been discovered in ClickHouse Server that, under certain conditions, could allow an unauthenticated user with network access to execute arbitrary code on the ClickHouse Server.",
"Suggestion": "Upgrade database engine \"clickhouse\" to version 26.3.62.3 or later to resolve CVE-2026-116366"
}
]
}
],
"Start": "2026-11-03T10:21:37.960585+07:00",
"End": "2026-11-03T10:21:38.872969+07:00"
}

--min-severity dropped the ELEVATED finding of the ClickHouse server. Extensions lists every extension that was checked, so it stays complete when --min-severity narrows Vulnerabilities. It is omitted for a database without extensions. A finding of the server version carries Engine in place of Name, and its Version is the server version. Title and Description are omitted for a record that carries neither. A target that failed before its connection was opened carries only URL and Error. One that opened and failed during inspection carries Driver and Version as well.

Or report only what a dashboard needs:

atlas security scan \
--url "postgres://postgres:pass@localhost:5432/app?sslmode=disable" \
--url "clickhouse://default:pass@localhost:9000" \
--format '{{ range .Targets }}{{ range .Vulnerabilities }}{{ println (or .Engine .Name) .ID .Level .Severity }}{{ end }}{{ end }}'
vector CVE-2026-103484 HIGH HIGH
vector CVE-2026-18022 HIGH HIGH
clickhouse CVE-2024-22412 ELEVATED LOW
clickhouse CVE-2026-116366 CRITICAL CRITICAL

or .Engine .Name prints the engine for a finding of the server version, and the extension for the rest. The last two columns show the two scales side by side: CVE-2024-22412 is rated LOW by CVSS and graded ELEVATED.

The template scope holds the scan:

FieldDescription
.TargetsThe scanned databases: .URL, .Driver, .Version, .Extensions, .Vulnerabilities and .Error.
.CountTotal number of issues reported.
.LevelsIssue counts per level, highest first, omitting the empty ones: .Level and .Count.
.FailuresNumber of databases that could not be scanned.
.FailedWhether any database could not be scanned.
.Start, .EndWhen the scan started and ended.

Each vulnerability holds .Name, .Engine, .Version, .ID, .Level, .Severity, .Title, .Description and .Suggestion, and .LevelText renders the line the default report prints. A finding of the server version sets .Engine and leaves .Name empty.

Running on a Schedule​

New CVEs are published for versions that are already installed, so the value of the scan comes from running it repeatedly rather than once. Both examples below pass the database URL from a secret and gate on HIGH. Point them at an --env instead once the target, the severity to fail on, and the endpoints to notify live in atlas.hcl.

The arigaio/atlas image has the Atlas binary as its entrypoint, so the manifest passes the command as args, and Kubernetes expands $(DATABASE_URL) from the container's environment:

cronjob.yaml
apiVersion: batch/v1
kind: CronJob
metadata:
name: atlas-security-scan
spec:
schedule: "0 6 * * *"
concurrencyPolicy: Forbid
jobTemplate:
spec:
# A gated scan exits non-zero on findings, which is a verdict rather than
# a transient error. Without this, the job retries it six more times.
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: atlas
image: arigaio/atlas:latest
args: ["security", "scan", "--url", "$(DATABASE_URL)", "--fail-on", "HIGH"]
env:
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: atlas-security-scan
key: database_url
# Read by the CLI itself, not passed as a flag.
- name: ATLAS_TOKEN
valueFrom:
secretKeyRef:
name: atlas-security-scan
key: atlas_token

The exit code is the whole signal here, so gate at the lowest severity you want to hear about. Anything the CVSS rated below HIGH is graded ELEVATED, so a job gated at HIGH stays green, and silent, on the most common finding there is. To receive the result itself rather than a pass or a fail, add a notify block, which lives in the security block of a config file.

On a cluster running the Atlas Kubernetes Operator, the AtlasSecurityScan resource replaces the CronJob above: it scans on a schedule and after an AtlasSchema or AtlasMigration listed in its triggers applies a change, and reports the verdict in Kubernetes conditions. See Security Scanning with the Operator.

Flags​

FlagDescription
-u, --urlDatabase URL(s) to scan. Repeat the flag or pass a comma-separated list to scan more than one. Required, unless the selected env sets url.
--min-severityLowest severity to report: NORMAL, ELEVATED, HIGH or CRITICAL. Replaces the level the security block shares between its checks.
--fail-onLowest severity that fails the command. Takes precedence over fail_on.
--ignoreCVE identifier(s) not to report. Added to the ones the cve check ignores.
--formatGo template to use to format the output.
--envEnv from the config file to use.
-c, --configConfig (project) file URL. file://atlas.hcl by default.
--varInput variables for the config file.

Next Steps​