Authorization Bypass in Starknet Snap via enableAuthorize parameter leads to unauthorized transaction signing
The Starknet Snap accepted an enableAuthorize parameter from the calling website, and when it was false the confirmation dialog was skipped. A malicious site could therefore sign arbitrary messages or transactions with the user's wallet without any approval, potentially leading to asset theft.
- Triaged in 29 days
- Fixed in 29 days
- Paid in 29 days
- Disclosed after 60 days
Summary:
The Starknet Snap by Consensys contains a critical security vulnerability that allows malicious websites to bypass user authorization when signing messages or transactions. The vulnerability exists in the enableAuthorize parameter which can be controlled by any website. When set to false, the confirmation dialog is not shown to the user, allowing a malicious website to sign arbitrary messages or transactions without user approval, potentially leading to asset theft.
Steps To Reproduce:
- Make sure MetaMask is installed
- Visit https://snaps.consensys.io/starknet
- Click "Connect with MetaMask" button to install the StarkNet Snap
- Download the html file: "exp-starknet.html" and host it on local port 5555
- Visit http://localhost:5555/exp-starknet.html
- Click "start PoC" button
- Accept the connection request
- Observe that the signMessage is shown in the page without user approval
Supporting Material/References:
The vulnerability exists in the following code: https://github.com/Consensys/starknet-snap/blob/main/packages/starknet-snap/src/rpcs/sign-message.ts#L77
protected async handleRequest(
params: SignMessageParams,
): Promise<SignMessageResponse> {
const { enableAuthorize, typedDataMessage, address } = params;
if (
// Get Starknet expected not to show the confirm dialog, therefore, `enableAuthorize` will set to false to bypass the confirmation
// TODO: enableAuthorize should set default to true
enableAuthorize &&
!(await renderSignMessageUI({
address,
typedDataMessage,
chainId: this.network.chainId,
}))
) {
throw new UserRejectedOpError() as unknown as Error;
}
return await signMessageUtil(
this.account.privateKey,
typedDataMessage,
address,
);
}
}
- exp-starknet.html - an example exploit Attachments: [{"filename":"exp-starknet.html","created_at":"2026-01-12T02:13:56.722Z","hai_attachment_description":null}]
Context
Starknet Snap is a MetaMask Snap published by Consensys that adds Starknet support to MetaMask. The report focuses on one of its RPC handlers, signMessage, which takes typed data and an address and produces a signature over that typed data using the snap's account private key.
Because a snap is invoked by web pages through MetaMask, the handler receives its parameters from the calling page. One of those parameters is enableAuthorize. The handler is supposed to show a confirmation dialog before signing, and to abort if the user rejects it. The report shows that the caller controls whether that dialog appears at all.
Setup
The preconditions are minimal:
- MetaMask is installed in the browser.
- The Starknet Snap is installed, which the report does by visiting the official page and clicking the connect button.
- The researcher's proof of concept,
exp-starknet.html, is hosted locally on port 5555.
No accounts, roles or special configuration beyond a normal MetaMask installation with the snap are described.
Finding it
The researcher looked at the source of the signMessage RPC in the starknet-snap repository, specifically packages/starknet-snap/src/rpcs/sign-message.ts around line 77. The handler destructures three values from the incoming parameters:
protected async handleRequest(
params: SignMessageParams,
): Promise<SignMessageResponse> {
const { enableAuthorize, typedDataMessage, address } = params;
if (
// Get Starknet expected not to show the confirm dialog, therefore, `enableAuthorize` will set to false to bypass the confirmation
// TODO: enableAuthorize should set default to true
enableAuthorize &&
!(await renderSignMessageUI({
address,
typedDataMessage,
chainId: this.network.chainId,
}))
) {
throw new UserRejectedOpError() as unknown as Error;
}
return await signMessageUtil(
this.account.privateKey,
typedDataMessage,
address,
);
}
}
The confirmation UI, renderSignMessageUI, is only reached when enableAuthorize is truthy. If the caller sends enableAuthorize: false, the whole if block is skipped and execution goes straight to signMessageUtil, which signs with this.account.privateKey. The comment in the code states the intent explicitly: the parameter exists so that callers such as Get Starknet can suppress the dialog, and there is a TODO noting that enableAuthorize should default to true. Since the parameter comes from the calling page, any website can choose its value.
Exploitation
Step 1: Install MetaMask and the snap
With MetaMask installed, the researcher visits the official Starknet Snap page and clicks "Connect with MetaMask" to install the snap. This is the same installation path a victim would follow.
Step 2: Host the proof of concept
The file exp-starknet.html is downloaded and served on local port 5555, then opened at http://localhost:5555/exp-starknet.html. The report attaches this file as the example exploit.
Step 3: Trigger the signing request
Clicking the "start PoC" button on the page triggers the signing request; the report does not reproduce the file's contents. The connection request is accepted, as any user would accept a dapp connection.
Step 4: Observe the result
The signed message appears in the page without any user approval. No confirmation dialog is displayed, because the handler skipped renderSignMessageUI entirely. From the user's point of view nothing happened; from the page's point of view it now holds a valid signature produced with the snap's private key.
Root cause
The authorisation decision is driven by a parameter supplied by the untrusted caller. enableAuthorize is meant to let a trusted integrator suppress the dialog, but nothing distinguishes a trusted integrator from an arbitrary web page, and nothing forces the value to true. The guard is written as enableAuthorize && !(await renderSignMessageUI(...)), so a falsy value short-circuits the check and the rejection path is never taken. The signing call itself has no independent authorisation check, so once the UI step is skipped there is nothing left between the request and a signature.
The code comment and the TODO show the developers knew the default should be true.
Impact
A malicious website that a user visits while the snap is installed can obtain signatures over arbitrary typed data without any prompt. The report states this can lead to asset theft, since a signature the user never saw or approved can authorise actions on the user's behalf. The attack requires the victim to have MetaMask and the Starknet Snap installed and to accept the connection request from the malicious page. The report's summary calls the issue critical, while the program recorded it as medium severity with a 350 USD bounty.
Fix
The report does not describe a fix that was applied. The code itself points at the direction: the TODO says enableAuthorize should default to true, so that a caller that does not explicitly opt out still gets the confirmation dialog. More generally, the authorisation decision should not rest on a value the calling page can set freely; the dialog should be the default path and any suppression should be tied to a trusted caller rather than a request parameter.
Variants to test
- Other snap RPCs that accept a similar flag controlling UI, such as parameters named like
enableAuthorize,skipConfirm,silentornoPrompt. A positive result is a signing or state-changing call that completes with no MetaMask window appearing. - Boolean parameters whose falsy value short-circuits a guard, as here. Send
false,0,nulland omit the field entirely, and check whether the confirmation still appears in each case. - Parameters that select between UI and non-UI code paths, for example a mode or origin field. A positive result is a request from an untrusted origin reaching the non-UI path.
- Default values on optional authorisation fields. If omitting the field skips the dialog, the default is wrong in the same way as this report.
Hunting notes
This class of bug hides in snap and wallet extension RPC handlers where a request parameter influences whether a confirmation is shown. During recon, read the handler source for any boolean that gates a render*UI call, and look for comments or TODOs admitting that a default is unsafe.
The researcher built a page that triggers the signing request and showed that the signed message appeared without user approval.
What happened, in plain words
MetaMask is a browser extension that acts as a wallet: it stores the keys that control your crypto assets and asks you to approve anything that touches them. A "Snap" is a small add-on for MetaMask, written by a third party, that teaches MetaMask about a particular blockchain. Starknet Snap, published by Consensys, is the add-on that lets MetaMask work with Starknet, a blockchain network.
One of the jobs the Starknet Snap can do is sign a message. A signature is a cryptographic stamp that proves the holder of a private key approved some piece of data. In normal use, when a website asks the snap to sign something, MetaMask should pop up a window showing you what is about to be signed and wait for you to click approve. If you click reject, nothing gets signed.
The report shows that this approval window can be switched off by the website making the request. The snap accepts a setting called enableAuthorize from the calling page. When the page sends it as false, the snap skips the approval window entirely and signs straight away. A malicious website can therefore obtain a signature from your wallet without you seeing or approving anything. The report says this can lead to theft of your assets, because a signature you never saw can authorise actions on your behalf.
Background concepts
Before walking through the report, here are the pieces it relies on.
- Private key: a long secret number that proves ownership of a wallet. Whoever holds it can sign things on the wallet's behalf. It must never leave the wallet.
- Signature: the output of combining a private key with some data. Anyone can check that a signature is genuine, but only the key holder can produce it. Think of it as a wax seal: easy to verify, hard to forge.
- RPC: "remote procedure call". A way for one program to ask another program to run a function. Here, a web page asks the snap to run its
signMessagefunction. An everyday comparison: ordering at a restaurant counter. You name a dish (the function) and hand over your choices (the parameters), and the kitchen does the work. - Parameter: one of the values passed along with an RPC call. In this report the parameters include the typed data to sign, the address to sign for, and the
enableAuthorizeflag. - Typed data: structured data (not just a plain string) that gets signed. Wallets can display it in a readable form so the user knows what they are approving.
- Confirmation dialog / UI: the pop-up window in MetaMask that shows the request and asks you to approve or reject it. In the code it is produced by a function called
renderSignMessageUI. - Authorisation bypass: a class of bug where a check that is supposed to stop an action from happening without permission can be avoided. Here the check is the approval window, and the bypass is a parameter that turns it off.
- Business logic error: a bug where the code does exactly what it was written to do, but the rule it enforces is wrong. Nothing crashes; the design itself is flawed. This report is classified that way.
- Truthy and falsy: in JavaScript, values like
false,0,nulland an empty string count as "falsy" (treated as no), while most other values count as "truthy" (treated as yes). A condition likeflag && somethingonly runssomethingwhenflagis truthy.
The setup
The report's preconditions are small:
- MetaMask is installed in the browser.
- The Starknet Snap is installed. The report does this by visiting the official page and clicking the connect button.
- The researcher's proof of concept file,
exp-starknet.html, is hosted locally on port 5555.
A proof of concept (PoC) is a small demonstration that proves a bug is real, rather than just theoretical. Hosting it locally means running a tiny web server on your own computer so the file can be opened in a browser like a normal website.
No accounts, roles or special configuration beyond a normal MetaMask installation with the snap are described.
Finding it
The researcher read the source code of the snap, which is public on GitHub. The relevant file is packages/starknet-snap/src/rpcs/sign-message.ts, around line 77. Reading the code is how many logic bugs are found: you look for a decision that is made using a value the attacker controls.
The handler looks like this:
protected async handleRequest(
params: SignMessageParams,
): Promise<SignMessageResponse> {
const { enableAuthorize, typedDataMessage, address } = params;
if (
// Get Starknet expected not to show the confirm dialog, therefore, `enableAuthorize` will set to false to bypass the confirmation
// TODO: enableAuthorize should set default to true
enableAuthorize &&
!(await renderSignMessageUI({
address,
typedDataMessage,
chainId: this.network.chainId,
}))
) {
throw new UserRejectedOpError() as unknown as Error;
}
return await signMessageUtil(
this.account.privateKey,
typedDataMessage,
address,
);
}
}
Line by line, in plain words:
protected async handleRequest(params: SignMessageParams): Promise<SignMessageResponse>declares the function that runs when a page asks the snap to sign a message.asyncmeans it can wait for slow things (like a pop-up) without freezing. It receivesparams(the caller's choices) and promises to return aSignMessageResponse(the signature).const { enableAuthorize, typedDataMessage, address } = params;pulls three values out of the incoming parameters: the approval flag, the data to sign, and the address to sign for. All three come from the calling web page.if (starts a condition. The block inside only runs when the condition is true.- The two comment lines explain the developers' intent: another product, Get Starknet, wanted no confirmation dialog, so
enableAuthorizewas set to false to skip it. TheTODOadmits the default should be true. enableAuthorize &&is the first half of the condition. If the caller sentfalse, JavaScript stops evaluating right here and the whole condition is false. The approval window is never even attempted.!(await renderSignMessageUI({ address, typedDataMessage, chainId: this.network.chainId }))is the second half. It shows the confirmation window, waits for the user, and the!flips the answer: if the user rejected, this becomes true.) {closes the condition.throw new UserRejectedOpError() as unknown as Error;is what happens when the user rejects: the function stops with an error saying the operation was rejected.return await signMessageUtil(this.account.privateKey, typedDataMessage, address);is the actual signing. It uses the snap's private key to sign the typed data for the address.
The key observation: the approval window is only reached when enableAuthorize is truthy. Send false and the whole if block is skipped, so execution goes straight to the signing call. The comment confirms the parameter exists so that trusted callers can suppress the dialog, and the TODO confirms the developers knew the default was wrong. Because the parameter comes from the calling page, any website can choose its value.
Exploitation
Step 1: Install MetaMask and the snap
With MetaMask installed, the researcher visits the official Starknet Snap page and clicks "Connect with MetaMask" to install the snap. This is the same installation path a victim would follow, which matters: the attack does not need anything unusual on the victim's machine, just the normal setup.
Step 2: Host the proof of concept
The file exp-starknet.html is downloaded and served on local port 5555, then opened at http://localhost:5555/exp-starknet.html. The report attaches this file as the example exploit. Serving it locally simulates a website the victim might visit; in a real attack the page would live on the attacker's server.
Step 3: Trigger the signing request
Clicking the "start PoC" button on the page triggers the signing request; the report does not reproduce the file's contents. The connection request is accepted, as any user would accept a dapp connection. A dapp is simply a website that talks to a wallet. Accepting the connection is the one interaction the victim performs; it looks like the normal prompt any site triggers.
Step 4: Observe the result
The signed message appears in the page without any user approval. No confirmation dialog is displayed, because the handler skipped renderSignMessageUI entirely. From the user's point of view nothing happened; from the page's point of view it now holds a valid signature produced with the snap's private key. That signature is the dangerous part: it can be used elsewhere to prove the wallet approved something the owner never saw.
Root cause
The authorisation decision is driven by a parameter supplied by the untrusted caller. enableAuthorize is meant to let a trusted integrator suppress the dialog, but nothing distinguishes a trusted integrator from an arbitrary web page, and nothing forces the value to true. The guard is written as enableAuthorize && !(await renderSignMessageUI(...)), so a falsy value short-circuits the check and the rejection path is never taken. The signing call itself has no independent authorisation check, so once the UI step is skipped there is nothing left between the request and a signature.
The code comment and the TODO show the developers knew the default should be true. A useful comparison: a hotel that lets guests write their own room number on the key card, with no check that the number is theirs.
Impact
A malicious website that a user visits while the snap is installed can obtain signatures over arbitrary typed data without any prompt. The report states this can lead to asset theft, since a signature the user never saw or approved can authorise actions on the user's behalf. The attack requires the victim to have MetaMask and the Starknet Snap installed and to accept the connection request from the malicious page. The report's summary calls the issue critical, while the program recorded it as medium severity with a 350 USD bounty.
Fix
The report does not describe a fix that was applied. The code itself points at the direction: the TODO says enableAuthorize should default to true, so that a caller that does not explicitly opt out still gets the confirmation dialog. More generally, the authorisation decision should not rest on a value the calling page can set freely; the dialog should be the default path and any suppression should be tied to a trusted caller rather than a request parameter.
Variants to test
Directions worth testing for similar bugs:
- Other snap RPCs that accept a similar flag controlling UI, such as parameters named like
enableAuthorize,skipConfirm,silentornoPrompt. A positive result is a signing or state-changing call that completes with no MetaMask window appearing. - Boolean parameters whose falsy value short-circuits a guard, as here. Send
false,0,nulland omit the field entirely, and check whether the confirmation still appears in each case. - Parameters that select between UI and non-UI code paths, for example a mode or origin field. A positive result is a request from an untrusted origin reaching the non-UI path.
- Default values on optional authorisation fields. If omitting the field skips the dialog, the default is wrong in the same way as this report.
Hunting notes
This class of bug hides in snap and wallet extension RPC handlers where a request parameter influences whether a confirmation is shown. During recon (the early phase where you map out what a target does), read the handler source for any boolean that gates a render*UI call, and look for comments or TODOs admitting that a default is unsafe. The signal is a guard written as flag && !(await showUI(...)), where a caller-controlled falsy value removes the check.
The researcher built a page that triggers the signing request and showed that the signed message appeared without user approval.
Glossary
- MetaMask: a browser extension wallet that stores crypto keys and asks the user to approve actions.
- Snap: a third-party add-on for MetaMask that adds support for a particular blockchain or feature.
- Starknet Snap: the Consensys-published snap that adds Starknet support to MetaMask.
- Starknet: a blockchain network that the snap lets MetaMask interact with.
- Private key: a secret number that proves ownership of a wallet and is used to create signatures.
- Signature: cryptographic proof, produced with a private key, that a piece of data was approved by the key holder.
- Typed data: structured data, rather than a plain string, that a wallet signs and can display in readable form.
- RPC (remote procedure call): a way for one program to ask another to run a named function with given parameters.
- Parameter: a value passed to a function or RPC call.
- Handler: the piece of code that runs when an RPC is called.
- Confirmation dialog / UI: the pop-up in a wallet that shows a request and asks the user to approve or reject it.
enableAuthorize: the request parameter in this report that controls whether the confirmation dialog is shown.renderSignMessageUI: the function that displays the signing confirmation dialog.signMessageUtil: the function that actually produces the signature using the private key.- Authorisation bypass: a bug where a permission check can be avoided, so an action happens without the required approval.
- Business logic error: a flaw in the rules the code enforces, rather than a crash or memory bug.
- Truthy / falsy: JavaScript's way of treating values as yes or no in a condition;
false,0,nulland empty strings are falsy. - Short-circuit: when the first half of a condition already decides the result, so the second half is never evaluated.
- Proof of concept (PoC): a small demonstration that proves a vulnerability is real.
- Dapp: a website that interacts with a crypto wallet.
- Recon: the early research phase of mapping out a target's behaviour and code.
- Severity: a rating of how serious a vulnerability is, here recorded as medium by the program.
- Bounty: a payment made by a bug bounty program for a valid report, here 350 USD.