Skip to content
Access control Disclosed report Intermediate

Circuit Breaker Authorization Issue

The circuit breaker module in the Cosmos SDK allowed a user with permission to reset only specific messages to reset any message's circuit breaker. An attacker with limited permissions could re-enable a disabled message, undermining the module's purpose and potentially allowing exploitation of a serious vulnerability.

strikeout Follow

Originally disclosed on HackerOne

Medium 4.9 View original
  • Disclosed after 27 days

Summary by the program

A bug was discovered in the Cosmos SDK in which an account that has authorization for some messages in the circuit breaker module could reset the circuit breaker for any message, despite not having that permission. An additional authorization check was added to ensure the permission model is correct.

Summary by the researcher

Summary of Impact

Circuit Breaker authorization model has a flaw. A user with SOME_MSGs permissions on a single message is able to reset ALL circuit breakers.

Details

The circuit breaker module is used for turning on or off messages in the Cosmos SDK. The idea is that if a serious vulnerability occurred, an administrator could trip the circuit breaker to disable the message, preventing exploitation.

There are two operations that are important for this module:

  • Trip: Turn off the service.
  • Reset: Turn on the service after it's been tripped.

There are three types of users with this:

  • ADMIN: Able to trip and reset allcircuit breakers. Additionally, they can grant additional permissions to other users for all user types.
  • ALL_MSGs: Able to trip and reset **all ** circuit breakers.
  • SOME_MSGs: Able to trip and reset some circuit breakers.

The SOME_MSGs user should only be able to act on particular messages, as designated by the name. This is true for tripping, as you can only trip the allowlisted message. However, this is not true for the reset functionality. If a user is granted permissions to a single message via SOME_MSGs permissions, they are able to reset ALL messages. This is the vulnerability.

From looking at the code for this module, for tripping a circuit breaker, the SOME_MSGs case checks to see if the user has access to the particular message. However, this loop is missing on the reset case.

Testing

Setting up a full blockchain via Ignite on this version of the Cosmos-SDK didn't seem possible. So, I created a test file for this instead. This is attached to this report. To use this, follow the steps below:

  1. Use Cosmos SDK version 50. I tested this on the v0.50.0-rc.0 specifically.
  2. Replace my file test file with cosmos-sdk/x/circuit/keeper/msg_server_test.go. This is the testing file used for this particular functionality.
  3. Go to the directory where the new test file was added.
  4. Run go test -mod=readonly -run TestResetCircuitBreakerMaxPOC -v to execute my test.
  5. Notice that even though the user only has access to url message, they are able to call reset on the url_bad message. This demonstrates the vulnerability discussed above.

Remediation

To remediate this problem, break out the Permissions_LEVEL_SOME_MSGS into its own block for ResetCircuitBreaker just like TripCircuitBreaker does and iterate over the loop to validate if they have access to the particular message to reset it.

Impact

Imagine that there is a module where the governance voted a user to have the ability to trip or reset a circuit breaker for a single message. Now, something extremely important and unrelated has a serious vulnerability in it, such as the banking module. The admin rushes to trip the circuit breaker on this message. However, to their surprise, two minutes later the message is turned on again. Users are exploiting this like mad until all of the funds have been drained. What happened? An authorization flaw in the circuit breaker allowed the message to be turned back on by an authorized user. Being able to turn back messages in this state is real bad and undermines the purpose of this module.

The original report as published on HackerOne, by strikeout. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

The Cosmos SDK is the framework used to build application-specific blockchains in the Cosmos ecosystem. One of its modules is the circuit breaker, whose purpose is defensive: if a serious vulnerability is found in some message handler, an administrator can trip the circuit breaker for that message, disabling it so that it cannot be exploited while a fix is prepared. When the danger has passed, the breaker is reset and the message works again.

The module recognises two operations:

  • Trip: turn the service off.
  • Reset: turn the service back on after it has been tripped.

Permissions are granted per user and come in three levels:

Level Trip Reset Grant permissions
ADMIN all circuit breakers all circuit breakers yes, to other users for all user types
ALL_MSGs all circuit breakers all circuit breakers no
SOME_MSGs some circuit breakers some circuit breakers no

The name SOME_MSGs is meant to be literal: a user holding it should only be able to act on the particular messages they have been allowlisted for. The report shows that this held for tripping but not for resetting.

Setup

The researcher could not stand up a full blockchain with Ignite on the affected version, so the proof of concept is a Go test file rather than a running chain. The preconditions are:

  1. Cosmos SDK version 50; the researcher tested specifically on v0.50.0-rc.0.
  2. A test file supplied with the report, to be placed at cosmos-sdk/x/circuit/keeper/msg_server_test.go, the existing test file for this functionality.
  3. A user holding SOME_MSGs permission for a single message, in the test named url, with a second message, url_bad, that the user has no permission for.

No accounts on a live network, no RPC endpoints and no special tooling beyond the Go toolchain are involved.

Finding it

The researcher compared the two privileged operations in the module's message server. For tripping a circuit breaker, the SOME_MSGs case checks whether the caller has access to the particular message before acting. For resetting, that loop is missing. The relevant code is in x/circuit/keeper/msg_server.go, at the trip handler and the reset handler respectively.

The asymmetry is the whole bug: the permission model is enforced on the way in (disabling a message) but not on the way out (re-enabling it). A user granted rights over one message can therefore reset every breaker in the module.

Exploitation

Step 1: prepare the test environment

Use Cosmos SDK version 50, tested on v0.50.0-rc.0, and replace the module's test file with the one attached to the report:

Text
cosmos-sdk/x/circuit/keeper/msg_server_test.go

This is the test file used for this particular functionality, so the proof of concept runs inside the module's own test harness rather than against a live chain.

Step 2: run the proof of concept

From the directory containing the new test file, execute:

Bash
go test -mod=readonly -run TestResetCircuitBreakerMaxPOC -v

The -run flag selects only the researcher's test, TestResetCircuitBreakerMaxPOC, and -v makes the test output verbose so the result is visible.

Step 3: observe the result

The test user holds permission only for the url message. Despite that, the test shows the user successfully calling reset on the url_bad message, which they were never authorised for. That single observation demonstrates the vulnerability: SOME_MSGs scoping is not applied to reset.

Root cause

In TripCircuitBreaker, the SOME_MSGs branch iterates over the caller's granted permissions and validates that the target message is among them. In ResetCircuitBreaker, that loop is absent, so the handler proceeds to reset whatever message is named in the request. The per-message allowlist check that guards tripping was simply not replicated in the reset path. The existing defence, the per-message allowlist check, simply was not replicated in the reset path.

Impact

The report frames the impact through governance. Suppose governance has voted a user the ability to trip or reset a circuit breaker for a single message. Separately, something important and unrelated, such as the banking module, is found to have a serious vulnerability. The administrator trips the circuit breaker on that message to stop exploitation. Two minutes later the message is turned back on. Users exploit the vulnerability until funds are drained.

The cause is the authorisation flaw: a user authorised for one message was able to re-enable a message they had no rights over. Being able to turn messages back on in this state undermines the entire purpose of the module, because the emergency stop can be undone by someone who was only ever trusted with a narrow slice of it. The platform rates the issue medium severity with a CVSS score of 4.9, under improper access control.

Fix

The program states that an additional authorisation check was added to ensure the permission model is correct. The researcher's suggested remediation is to break out the Permissions_LEVEL_SOME_MSGS case into its own block for ResetCircuitBreaker, exactly as TripCircuitBreaker does, and iterate over the loop to validate that the caller has access to the particular message being reset.

Variants to test

  1. Other paired operations with asymmetric checks. Look for modules where a privileged action has an inverse (enable/disable, freeze/unfreeze, pause/resume) and compare the authorisation code for each direction. A positive result is an inverse handler that skips the per-resource allowlist its counterpart enforces.
  2. Per-resource allowlists on bulk or wildcard inputs. Send a request naming a resource outside the caller's grant, or a wildcard that expands to several resources. A positive result is the handler acting on anything beyond the explicitly granted set.
  3. Coarse level check without scope check. Grant the lowest privileged level that still passes the entry check and attempt an operation on an unrelated resource. A positive result is success where only the higher level should have permitted it.
  4. Governance-granted narrow permissions. Where permissions are assigned by governance vote for a single item, verify that every operation on that permission honours the item scope, not just the first one implemented.

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

What happened, in plain words

Cosmos is a family of blockchains, and most of them are built with a shared set of building blocks called the Cosmos SDK. Think of the SDK as a large box of Lego: each piece (called a module) adds one feature to a blockchain, such as sending money or voting on proposals.

One of those modules is the circuit breaker. The name comes from electrical fuses: when something goes dangerously wrong, a switch flips and cuts the power before damage spreads. In the Cosmos SDK the circuit breaker does the same for individual messages. A message here is simply an instruction a user can send to the blockchain, for example "transfer funds". If someone finds a serious security hole in the code that handles a particular message, an administrator can trip the breaker for that message, which switches it off so nobody can use it while a fix is written. Later, when the danger has passed, the breaker is reset and the message works again.

This report is about a mistake in who is allowed to do those two things. Some users are only trusted with a narrow slice of the circuit breaker: they may switch off and switch back on a few specific messages, not all of them. The researcher found that this limit was enforced when switching a message off, but not when switching it back on. So a user trusted with one small message could re-enable any message in the system, including one an administrator had deliberately disabled because it was dangerous.

The platform rates the issue medium severity, with a CVSS score of 4.9, and classifies it as improper access control. CVSS is a standard scoring system where a higher number means a more serious problem; 4.9 sits in the middle of the scale.

The product and the feature

What the Cosmos SDK is

A blockchain is a shared record book that many independent computers keep in sync, so that no single person can quietly rewrite history. Building one from scratch is a huge amount of work, so developers use a framework. The Cosmos SDK is such a framework: it gives you the record book, the networking and the common features, and you add your own pieces on top. Each piece is a module.

What the circuit breaker module does

The circuit breaker module is a safety switch for the other modules. Its whole purpose is defensive. If a serious vulnerability is discovered in the code that processes some message, an administrator can disable that message immediately, before an attacker manages to abuse it, and keep it disabled until a patched version is ready. Once the fix is in place, the breaker is reset and normal service resumes.

The module recognises two operations:

  • Trip: turn the service off.
  • Reset: turn the service back on after it has been tripped.

The three permission levels

Not everyone should be able to flip these switches, so the module hands out permissions. A permission is simply a label attached to a user account saying what that account may do. There are three levels:

Level Trip Reset Grant permissions
ADMIN all circuit breakers all circuit breakers yes, to other users for all user types
ALL_MSGs all circuit breakers all circuit breakers no
SOME_MSGs some circuit breakers some circuit breakers no

The name SOME_MSGs is meant to be taken literally. A user holding it should only be able to act on the particular messages they have been explicitly listed for. That list is called an allowlist: a list of things you are allowed to touch, and anything not on the list is off limits. The report shows that this restriction worked for tripping but not for resetting.

Setting up the test

Normally a security researcher would try the attack against a real, running blockchain. Here that was not practical: the researcher could not stand up a full blockchain with Ignite on the affected version. Ignite is a tool that generates and runs a Cosmos blockchain for you, and setting up a full chain on this version did not seem possible. So the proof of concept is a Go test file instead of a live chain. Go is the programming language the Cosmos SDK is written in, and a test file is a small program that exercises one piece of code and checks the result, without needing the whole system around it.

The preconditions are:

  1. Cosmos SDK version 50; the researcher tested specifically on v0.50.0-rc.0. The rc stands for release candidate, a version published just before the final release.
  2. A test file supplied with the report, to be placed at cosmos-sdk/x/circuit/keeper/msg_server_test.go, which is the existing test file for this functionality.
  3. A user holding SOME_MSGs permission for a single message, called url in the test, plus a second message, url_bad, that the same user has no permission for.

No accounts on a live network, no RPC endpoints and no special tooling beyond the Go toolchain are involved. An RPC endpoint is a network address a program uses to talk to a blockchain node; none is needed here because everything runs locally.

Finding the flaw

The researcher compared the code behind the two privileged operations in the module's message server. The message server is the part of the module that receives incoming requests and decides whether to carry them out. For tripping a circuit breaker, the SOME_MSGs case checks whether the caller has access to the particular message before acting. For resetting, that check is missing. The relevant code lives in x/circuit/keeper/msg_server.go, at the trip handler and the reset handler respectively.

That asymmetry is the whole bug. The permission model is enforced on the way in, when disabling a message, but not on the way out, when re-enabling it. A user granted rights over one message can therefore reset every breaker in the module.

Reproducing it

Step 1: prepare the test environment

Use Cosmos SDK version 50, tested on v0.50.0-rc.0, and replace the module's test file with the one attached to the report:

Text
cosmos-sdk/x/circuit/keeper/msg_server_test.go

This is a file path, not a command. It points to the place inside the SDK's source folder where the module's own tests live. Swapping in the researcher's file means the proof of concept runs inside the module's existing test harness, the scaffolding that sets up a fake environment for the code under test, rather than against a live chain. That keeps the experiment small and repeatable.

Step 2: run the proof of concept

From the directory containing the new test file, execute:

Bash
 go test -mod=readonly -run TestResetCircuitBreakerMaxPOC -v

Line by line:

  • go test is the Go toolchain's built-in command for running tests. You do not install anything extra; it ships with Go.
  • -mod=readonly tells Go to use exactly the dependencies already recorded for the project and not to modify the dependency files. A dependency is another piece of software this project relies on. This flag keeps the experiment from quietly changing the project's setup.
  • -run TestResetCircuitBreakerMaxPOC selects only the researcher's test, named TestResetCircuitBreakerMaxPOC, and skips all the others in the file. The name is a label the researcher chose; POC stands for proof of concept.
  • -v makes the output verbose, meaning it prints details about each test as it runs, so the result is visible rather than just a silent pass or fail.

Step 3: observe the result

The test user holds permission only for the url message. Despite that, the test shows the user successfully calling reset on the url_bad message, which they were never authorised for. That single observation demonstrates the vulnerability: the SOME_MSGs scoping is simply not applied to reset.

Why it happens

In TripCircuitBreaker, the SOME_MSGs branch iterates over the caller's granted permissions and validates that the target message is among them. "Iterates" means it walks through the list one entry at a time, checking each. In ResetCircuitBreaker, that walk is absent, so the handler goes ahead and resets whatever message is named in the request.

The per-message allowlist check that guards tripping was simply not copied into the reset path. That is why the flaw is one of scope rather than a complete absence of authorisation: the door is locked, but the key opens more rooms than it should. The existing defence, the per-message allowlist check, was simply not copied into the reset path.

Impact

The report frames the impact through governance. Governance here means the voting process by which a blockchain's community makes decisions, including who gets which permissions. Suppose governance has voted a user the ability to trip or reset a circuit breaker for a single message. Separately, something important and unrelated, such as the banking module, is found to have a serious vulnerability. The administrator trips the circuit breaker on that message to stop exploitation. Two minutes later the message is turned back on. Users exploit the vulnerability until funds are drained.

The cause is the authorisation flaw: a user authorised for one message was able to re-enable a message they had no rights over. Being able to turn messages back on in this state undermines the entire purpose of the module, because the emergency stop can be undone by someone who was only ever trusted with a narrow slice of it.

The fix

The program states that an additional authorisation check was added to ensure the permission model is correct. The researcher's suggested remediation is to break out the Permissions_LEVEL_SOME_MSGS case into its own block for ResetCircuitBreaker, exactly as TripCircuitBreaker does, and iterate over the loop to validate that the caller has access to the particular message being reset. In plain terms: make the reset path perform the same per-message allowlist check the trip path already performs.

Similar things to look for elsewhere

  1. Paired operations with mismatched checks. Look for modules where a privileged action has an inverse (enable/disable, freeze/unfreeze, pause/resume) and compare the authorisation code for each direction. A positive result is an inverse handler that skips the per-resource allowlist its counterpart enforces.
  2. Per-resource allowlists on bulk or wildcard inputs. Send a request naming a resource outside the caller's grant, or a wildcard that expands to several resources. A positive result is the handler acting on anything beyond the explicitly granted set.
  3. Coarse level check without scope check. Grant the lowest privileged level that still passes the entry check and attempt an operation on an unrelated resource. A positive result is success where only the higher level should have permitted it.
  4. Governance-granted narrow permissions. Where permissions are assigned by governance vote for a single item, verify that every operation on that permission honours the item scope, not just the first one implemented.

Glossary

  • Blockchain: a shared record book kept in sync by many independent computers, designed so no single party can rewrite it unnoticed.
  • Cosmos SDK: a framework for building application-specific blockchains, made of modules.
  • Module: a self-contained piece of software that adds one feature to a blockchain.
  • Circuit breaker: a safety switch that can disable a message so it cannot be exploited while a fix is prepared.
  • Message: an instruction a user sends to a blockchain, such as a transfer.
  • Trip: switch a message off.
  • Reset: switch a message back on after it has been tripped.
  • Permission: a label on an account saying what it may do.
  • Allowlist: a list of things you are allowed to touch; anything not on it is off limits.
  • ADMIN: the highest permission level, able to trip and reset all breakers and grant permissions to others.
  • ALL_MSGs: a permission level able to trip and reset all breakers, but not to grant permissions.
  • SOME_MSGs: a permission level able to trip and reset only the specific messages it has been allowlisted for.
  • Improper access control: a class of vulnerability where someone can do something they should not be allowed to do.
  • CVSS: a standard scoring system for the severity of a security issue; higher is worse.
  • Ignite: a tool for generating and running a Cosmos blockchain.
  • Go: the programming language the Cosmos SDK is written in.
  • Test file: a small program that exercises one piece of code and checks the result.
  • Test harness: the scaffolding that sets up a controlled environment for running tests.
  • Release candidate (rc): a version published just before the final release.
  • RPC endpoint: a network address a program uses to talk to a blockchain node.
  • Dependency: another piece of software a project relies on.
  • Message server: the part of a module that receives requests and decides whether to carry them out.
  • Handler: the function that processes a particular kind of request.
  • Iterate: walk through a list one entry at a time.
  • Governance: the voting process by which a blockchain's community makes decisions, including who gets which permissions.
  • Proof of concept (POC): a small demonstration that a vulnerability really exists.
  • Remediation: the fix for a vulnerability.
  • Scope: the range of things an action is allowed to affect.

More by strikeout

View all

1 more disclosed report, best first.

More from Cosmos

View all

The newest disclosed reports for this program.

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.