Skip to content
Account takeover Write-up Intermediate

Authentication Bypass in Izanami Docker image 1.10.22 CVE-2023-22495

The official Izanami Docker image uses a hard-coded secret to sign authentication tokens (JWTs). An attacker can install their own instance, log in, copy the cookie, and use it to authenticate to any other instance that uses the same default secret, even if the attacker's user does not exist on the victim instance.

Raphaël Lob Follow

Published on synacktiv.com

Vulnerabilities description Izanami Izanami is a shared configuration, feature flipping and A/B testing service perfectly well suited for micro services environments written in scala and developed by the MAIF OSS team.

Raphaël Lob, on synacktiv.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. 5 min read.

Context

Izanami is a shared configuration, feature flipping and A/B testing service, written in Scala and developed by the MAIF OSS team. It is aimed at micro services environments: services read their configuration and feature flags from a central Izanami instance instead of carrying them in their own code.

Because it holds configuration for many services, access to an Izanami instance matters. The application authenticates users and signs its authentication token as a JWT, and the cookie carrying that token is named Izanami. The signing key comes from an environment variable called APPLICATION_SECRET.

This advisory covers an authentication bypass that works when Izanami is deployed from the official Docker image. The root cause is a hard coded secret used to sign the authentication token, which lets an attacker forge a valid cookie for any instance that shares the same secret.

Setup

The issue affects deployments made with the official Docker image. At the time of writing, version 1.10.22 was proven to be affected, and previous versions are likely to be vulnerable too.

The latest release at the time could be downloaded from the Docker Hub page for maif/izanami:

Text
https://hub.docker.com/layers/maif/izanami/1.10.22-SNAPSHOT/images/[redacted]?context=explore

No special account on the victim side is needed: the attacker only needs to be able to run their own Izanami instance and to reach the victim's website.

Finding it

The problem is visible in the image itself. The official Izanami Docker image sets APPLICATION_SECRET to a fixed value. The advisory shows this in the Docker Hub layer view.

Illustration 1: APPLICATION_SECRET is set to a fixed value.

The APPLICATION_SECRET variable is what the application uses to sign cookies. The project's own documentation confirms this role.

Illustration 2: Extract of the documentation (izanami-documentation/src/main/paradox/settings/settings.md).

A secret that is identical in every deployment of the official image means that a token signed by one instance is accepted by every other instance built from the same image. Since the token is a JWT carried in the Izanami cookie, an attacker who can obtain a validly signed token from an instance they control can present it to a victim instance.

Exploitation

The bypass follows four steps.

Step 1: install your own Izanami

The attacker installs their own Izanami application, using the official image and therefore the same hard coded APPLICATION_SECRET.

Step 2: log in and copy the cookie

The attacker logs in to their own instance and copies the content of the cookie named Izanami. That cookie holds a JWT signed with the shared secret.

Step 3: plant the cookie on the victim

The attacker connects to the victim's website and creates a cookie named Izanami with the value copied in step 2.

Step 4: access granted

The attacker is successfully logged in, even though their user does not exist on the victim instance.

Root cause

The secret used to sign the authentication JWT is baked into the official Docker image. The build definition in izanami-server/build.sbt sets it as a Docker environment variable:

Text
dockerCommands ++= Seq(
  Cmd("ENV", "APP_NAME izanami"),
  Cmd("ENV", "APP_VERSION 1.0.6-SNAPSHOT"),
  Cmd("ENV", "LEVEL_DB_PARENT_PATH /leveldb"),
  Cmd("ENV", "REDIS_PORT 6379"),
  Cmd("ENV", "REDIS_HOST redis"),
  Cmd("ENV", "KAFKA_HOST kafka"),
  Cmd("ENV", "KAFKA_PORT 9092"),
  Cmd("ENV", "HTTP_PORT 8080"),
  Cmd("ENV", "APPLICATION_SECRET 2nJS=TpH/qBfB=NI6:H/jt3@5B3IBhzD4OjWi=tCH50Bjy2=JCXO^]XeZUW47Gv4")
)
dockerExposedVolumes ++= Seq(
  "/leveldb",
  "/data"
)
dockerUsername := Some("maif")
dockerEntrypoint := Seq("/opt/docker/bin/start.sh")

The APPLICATION_SECRET entry is the one that matters: every container started from this image signs its JWTs with the same value. Signature verification therefore proves only that a token was issued by some instance of the image, not that it was issued by this instance for a real user. The advisory's proof of concept shows a token for a non-existent user being accepted.

Impact

An attacker can authenticate to any Izanami instance deployed with the official Docker image, without holding an account on it. The advisory's proof of concept shows login succeeding even though the attacker's user does not exist on the victim instance.

The bypass depends on the victim running the official image with the hard coded secret. Instances where APPLICATION_SECRET has been set to a different value are not affected by this specific token.

Fix

The recommendation is to randomise the value of the APPLICATION_SECRET variable. The security experts identified a script that could fix the issue, in izanami-server/docker/start.sh:

Bash
#!/bin/bash -e
APPLICATION_SECRET=$(head -c 64 /dev/urandom | base64)
HOST=$(awk 'END{print $1}' /etc/hosts)
exec /opt/docker/bin/izanami -Dlogger.file=./conf/docker-logger.xml -Dcluster.akka.remote.netty.tcp.hostname="${HOST}" -Dcluster.akka.remote.netty.tcp.bindhostname="${HOST}" -Dplay.server.pidfile.path=/dev/null $@

The script generates a fresh 64-byte random secret, base64 encoded, at container start, so each deployment would sign its tokens with a value that is not shared with anyone else.

Timeline

Date Action
2022-12-21 Advisory sent to [redacted]
2023-01-13 CVE-2023-22495 assigned
2023-02-03 Public release

Variants to test

  1. Other official images with baked-in secrets. Pull the image and inspect its environment variables and entrypoint for values that look like signing keys, session secrets or API keys. A positive result is a secret that is identical across pulls and that the application uses to sign or encrypt client-side state.
  2. JWT cookies accepted without a local user check. On any application that issues a JWT in a cookie, obtain a token from an instance you control and present it to another instance. A positive result is being logged in as a user that does not exist on the target.
  3. Secret reuse across deployments. Compare the APPLICATION_SECRET-style variable between a default deployment and a hardened one. If the default value is fixed and the application starts without complaint, the deployment is exposed to the same class of bypass.
  4. Entrypoint scripts that generate secrets at start. Check whether the image generates its secret at runtime, as the fixed start.sh above does. A positive result for the defender is a secret that changes on every container start; a fixed value in the image is the finding.

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. 13 min read.

What happened, in plain words

Izanami is a service that other programs use to look up their settings and to switch features on and off. Imagine a large company where every team keeps its rules in one shared notebook instead of writing them separately in each office. Izanami is that notebook, but for software: many small programs (called micro services) ask a central Izanami server what their configuration is and which features are enabled. Because that notebook holds the settings of many programs, only trusted people should be able to open it.

To decide who is allowed in, Izanami gives each logged-in user a small piece of data called a token. The token is stored in the browser as a cookie. A cookie is a small text file that a website asks your browser to keep and to send back on every later visit, so the site can remember who you are. Izanami's cookie is named Izanami, and the token inside it is a JWT (JSON Web Token), a standard format for a signed piece of data.

The important part is the word signed. A JWT carries a cryptographic signature, produced with a secret key, much like a wax seal on an envelope. Anyone can look at the seal, but only someone holding the stamp can produce it. When the server receives the cookie, it checks the seal with its own copy of the secret. If the seal is valid, the server trusts the contents.

Synacktiv found that the official Docker image of Izanami ships with a fixed, hard coded secret. A Docker image is a ready-made package containing an application and everything it needs to run; you download it and start it, and it behaves the same everywhere. Because the secret is the same in every copy of that image, the stamp is the same everywhere. An attacker can therefore run their own Izanami, log in there to obtain a properly sealed token, and then present that token to somebody else's Izanami. The victim's server checks the seal, finds it valid, and lets the attacker in, even though the attacker has no account on the victim's system.

This is called an authentication bypass: a way to get past the login check without knowing a valid username and password. The weakness was assigned the identifier CVE-2023-22495. A CVE is a public catalogue number given to a known security flaw so that people can talk about it unambiguously.

The advisory was written by Raphaël Lob and published on 3 February 2023.

The product and why its login matters

Izanami is described as a shared configuration, feature flipping and A/B testing service, suited to micro services environments, written in Scala and developed by the MAIF OSS team.

  • Shared configuration: instead of each program carrying its own settings inside its code, the programs ask Izanami for them. Change the setting once in Izanami and every program picks it up.
  • Feature flipping (also called feature flags): a switch that turns a feature on or off for users without redeploying the software. Like a light switch in a building, the wiring stays the same but the room is lit or dark.
  • A/B testing: showing two variants of something to different groups of users and comparing the results.
  • Micro services: an approach where a large application is split into many small programs that talk to each other over the network.
  • Scala: a programming language that runs on the Java virtual machine.

Because Izanami holds the configuration and the switches for many services, being able to log in to it is valuable to an attacker. The application authenticates users and signs its authentication token as a JWT, and the cookie carrying that token is named Izanami. The signing key comes from an environment variable called APPLICATION_SECRET. An environment variable is a named value that is passed to a program when it starts, a bit like a note handed to a new employee on their first day telling them where the stationery cupboard is.

Affected versions

At the time of writing, version 1.10.22 was proven to be affected. Previous versions are likely to be vulnerable too. The issue affects deployments made with the official Docker image.

The latest release at the time could be downloaded from the Docker Hub page for maif/izanami:

Text
https://hub.docker.com/layers/maif/izanami/1.10.22-SNAPSHOT/images/[redacted]?context=explore

This is a link to a page on Docker Hub, the public website where Docker images are published. The long string starting with sha256 identifies one exact version of the image, so that everyone looking at the link sees the same contents. The page lets you browse the layers of the image, that is, the individual steps that were used to build it, including the environment variables that were set.

No special account on the victim side is needed: the attacker only needs to be able to run their own Izanami instance and to reach the victim's website.

How the bypass works, step by step

The advisory describes four steps.

  1. The attacker installs their own Izanami application.
  2. The attacker logs in and copies the content of the cookie named Izanami.
  3. The attacker connects to the victim's website and creates a cookie named Izanami with the previous value.
  4. The attacker is successfully logged in, even if their user does not exist.

Why each step is taken:

  1. The attacker needs a token that is correctly signed. The easiest way to get one is to run the same software with the same built-in secret and ask it to log them in. Their own instance happily produces a validly sealed token.
  2. Logging in makes the server issue the cookie. Copying its value gives the attacker the sealed token as a piece of text they can reuse elsewhere.
  3. The victim's site only looks at the cookie the browser sends. By planting the copied cookie in their own browser for the victim's site, the attacker makes the browser present the stolen seal to the victim.
  4. The attacker is successfully logged in, even if their user does not exist on the victim's system.

A useful comparison: imagine a club where the bouncer only checks that the membership card has the club's official stamp, and never checks the name on the card against a list. If the stamp is the same for every branch of the club, a card stamped at one branch gets you into all of them, even under a made-up name.

Where the problem is visible

The problem can be seen in the image itself. The official Izanami Docker image sets APPLICATION_SECRET to a fixed value. The advisory shows this in the Docker Hub layer view.

Illustration 1: APPLICATION_SECRET is set to a fixed value.

The APPLICATION_SECRET variable is what the application uses to sign cookies. The project's own documentation confirms this role.

Illustration 2: Extract of the documentation (izanami-documentation/src/main/paradox/settings/settings.md).

In other words, the first illustration shows the fixed value sitting in the image's environment settings, and the second shows the project's documentation stating that this variable is the one used to sign cookies. Together they establish that every deployment of the official image shares the same signing key.

The root cause in the build file

The secret used to sign the authentication JWT is baked into the official Docker image. The build definition in izanami-server/build.sbt sets it as a Docker environment variable:

Text
dockerCommands ++= Seq(
  Cmd("ENV", "APP_NAME izanami"),
  Cmd("ENV", "APP_VERSION 1.0.6-SNAPSHOT"),
  Cmd("ENV", "LEVEL_DB_PARENT_PATH /leveldb"),
  Cmd("ENV", "REDIS_PORT 6379"),
  Cmd("ENV", "REDIS_HOST redis"),
  Cmd("ENV", "KAFKA_HOST kafka"),
  Cmd("ENV", "KAFKA_PORT 9092"),
  Cmd("ENV", "HTTP_PORT 8080"),
  Cmd("ENV", "APPLICATION_SECRET 2nJS=TpH/qBfB=NI6:H/jt3@5B3IBhzD4OjWi=tCH50Bjy2=JCXO^]XeZUW47Gv4")
)
dockerExposedVolumes ++= Seq(
  "/leveldb",
  "/data"
)
dockerUsername := Some("maif")
dockerEntrypoint := Seq("/opt/docker/bin/start.sh")

Line by line, in plain words:

  • dockerCommands ++= Seq( starts a list of instructions that will be added to the commands used to build the Docker image. The ++= means "add these to the existing list".
  • Cmd("ENV", "APP_NAME izanami"), sets an environment variable called APP_NAME to the value izanami, so the running program knows its own name.
  • Cmd("ENV", "APP_VERSION 1.0.6-SNAPSHOT"), sets APP_VERSION, a label for the version of the application.
  • Cmd("ENV", "LEVEL_DB_PARENT_PATH /leveldb"), tells the application where to keep its local database files on disk.
  • Cmd("ENV", "REDIS_PORT 6379"), and Cmd("ENV", "REDIS_HOST redis"), tell it how to reach Redis, a separate storage service, and on which port. A port is a numbered door on a computer through which a particular service is reached.
  • Cmd("ENV", "KAFKA_HOST kafka"), and Cmd("ENV", "KAFKA_PORT 9092"), do the same for Kafka, a service for passing messages between programs.
  • Cmd("ENV", "HTTP_PORT 8080"), sets the port on which Izanami's web interface listens.
  • Cmd("ENV", "APPLICATION_SECRET 2nJS=TpH/qBfB=NI6:H/jt3@5B3IBhzD4OjWi=tCH50Bjy2=JCXO^]XeZUW47Gv4") is the line that matters. It sets the signing secret to a fixed string that is written directly in the build file, so every image built from this file contains the same secret.
  • ) closes the list of commands.
  • dockerExposedVolumes ++= Seq( starts a list of folders that are declared as volumes, meaning storage that can be kept outside the container so data survives a restart.
  • "/leveldb", and "/data" are those two folders.
  • ) closes the list.
  • dockerUsername := Some("maif") sets the account name under which the image is published, here maif.
  • dockerEntrypoint := Seq("/opt/docker/bin/start.sh") says that when a container starts, it should run the script start.sh. This is the script that the fix later changes.

Every container started from this image signs its JWTs with the same value. Signature verification therefore proves only that a token was issued by some instance of the image, not that it was issued by this instance for a real user. The application does not tie the token to a locally existing account, which is why a token for a non-existent user is accepted.

What an attacker gains

An attacker can authenticate to any Izanami instance deployed with the official Docker image, without holding an account on it. The proof of concept shows login succeeding even though the attacker's user does not exist on the victim instance.

To put it in everyday terms: the attacker does not get the keys to one office, they get to read and change the settings that many programs depend on.

The bypass depends on the victim running the official image with the hard coded secret. Instances where APPLICATION_SECRET has been set to a different value are not affected by this specific token.

The fix

The recommendation is to randomise the value of the APPLICATION_SECRET variable. The security experts identified a script that could fix the issue, in izanami-server/docker/start.sh:

Bash
#!/bin/bash -e
APPLICATION_SECRET=$(head -c 64 /dev/urandom | base64)
HOST=$(awk 'END{print $1}' /etc/hosts)
exec /opt/docker/bin/izanami -Dlogger.file=./conf/docker-logger.xml -Dcluster.akka.remote.netty.tcp.hostname="${HOST}" -Dcluster.akka.remote.netty.tcp.bindhostname="${HOST}" -Dplay.server.pidfile.path=/dev/null $@

Line by line, in plain words:

  • #!/bin/bash -e is the first line of a shell script. It says the script should be run by the program bash, and the -e means "stop immediately if any command fails", so a problem does not go unnoticed.
  • APPLICATION_SECRET=$(head -c 64 /dev/urandom | base64) creates a brand new secret every time the container starts. head -c 64 /dev/urandom takes 64 bytes from the operating system's source of random data, and base64 turns those raw bytes into text that is safe to use as a value. The result is stored in the APPLICATION_SECRET variable. Because it is generated fresh at start, no two deployments share it.
  • HOST=$(awk 'END{print $1}' /etc/hosts) works out the machine's own hostname by reading the last line of the system's hosts file and taking its first field. This is used so the application knows how to refer to itself on the network.
  • exec /opt/docker/bin/izanami ... replaces the script with the Izanami program itself and passes it several settings: where to write its log file, the hostname for its internal cluster communication (given twice, once as the advertised name and once as the address to bind to), and a path for a process identifier file that is set to /dev/null so no such file is written. The $@ at the end passes along any extra arguments the container was started with.

The script generates a fresh 64-byte random secret, base64 encoded, at container start, so each deployment would sign its tokens with a value that is not shared with anyone else. Going back to the club comparison: every branch now has its own unique stamp, so a card stamped at one branch is worthless at another.

Timeline

Date Action
2022-12-21 Advisory sent to [redacted]
2023-01-13 CVE-2023-22495 assigned
2023-02-03 Public release

The first date is when the advisory was sent to [redacted] The second is when the public catalogue number was assigned. The third is when the advisory became public.

Related things worth checking

  1. Other official images with baked-in secrets. Download an image and look at its environment variables and its start-up script for values that look like signing keys, session secrets or API keys. A positive result is a secret that is identical every time you download the image and that the application uses to sign or encrypt data kept in the user's browser.
  2. JWT cookies accepted without a local user check. On any application that puts a JWT in a cookie, obtain a token from an instance you control and present it to another instance. A positive result is being logged in as a user that does not exist on the target.
  3. Secret reuse across deployments. Compare the APPLICATION_SECRET-style variable between a default deployment and a hardened one. If the default value is fixed and the application starts without complaint, the deployment is exposed to the same class of bypass.
  4. Start-up scripts that generate secrets at start. Check whether the image generates its secret at runtime, as the fixed start.sh above does. For a defender, a good result is a secret that changes on every container start; a fixed value in the image is the finding.

Glossary

  • A/B testing: showing two variants of something to different groups of users and comparing how each group behaves.
  • API: a defined way for one program to ask another program to do something or give it data, like a menu of requests a service accepts.
  • Authentication: the process of proving who you are, usually with a username and password.
  • Authentication bypass: getting past a login check without valid credentials.
  • Base64: a way of writing raw binary data as ordinary text characters so it can be stored or sent safely.
  • Bash: a common command-line shell, a program that runs commands written in a script file.
  • Container: a running instance of a Docker image, isolated from the rest of the machine.
  • Cookie: a small piece of text a website asks your browser to store and send back on later requests, used to remember who you are.
  • CVE: a public catalogue number assigned to a known security vulnerability.
  • Docker: software for packaging an application and its dependencies into an image that runs the same way everywhere.
  • Docker Hub: the public website where Docker images are published and downloaded.
  • Docker image: a ready-made package containing an application and everything it needs to run.
  • Environment variable: a named value passed to a program when it starts, used for settings such as ports and secrets.
  • Feature flag / feature flipping: a switch that turns a feature on or off without changing the software's code.
  • Hard coded: written directly into the source code or build files rather than supplied from outside at run time.
  • Hostname: the name by which a computer is known on a network.
  • HTTP port: a numbered door on a computer through which a web service is reached.
  • JWT (JSON Web Token): a standard text format for a signed piece of data, often used to carry proof of login.
  • Kafka: a service for passing messages between programs.
  • Micro services: an approach where a large application is split into many small programs that talk over a network.
  • Port: a numbered door on a computer through which a particular service is reached.
  • Proof of concept: a demonstration that a vulnerability can actually be exploited.
  • Redis: a fast storage service often used to keep data in memory.
  • Root cause: the underlying reason a vulnerability exists.
  • Secret (signing key): a private value used to produce and verify cryptographic signatures; whoever holds it can create valid tokens.
  • Signature: a cryptographic seal attached to data that proves it was produced by someone holding the secret key and was not altered.
  • Token: a piece of data issued after login that stands in for your credentials on later requests.
  • Volume: storage declared outside a container so that data survives restarts.
  • Vulnerability: a weakness in software that can be used to cause harm or gain unauthorised access.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.