Improper bot-authentication allows to impersonate any user when sending messages in a room
The bot-key authentication split the key on a hyphen and looked up a user by the left part and the right part as the token. When the key had no right-hand side, the token became nil and matched any active user whose bot_token was also nil, so an unauthenticated attacker could post messages as any such user.
- Triaged in 4 days
- Fixed in 5 days
- Paid in 4 days
- Disclosed after 3 months
Bots are allowed to send messages in rooms but require a bot key to authenticate. The bot key authentication function is as follows:
def authenticate_bot(bot_key)
bot_id, bot_token = bot_key.split("-")
active.find_by(id: bot_id, bot_token: bot_token)
end
The issue is that if bot_key has no right-hand side (ex: 1-), bot_token will be nil, and the query will match a User record if bot_id matches a valid ID.
IDs are incremental, as can be seen in the rails console, so they can be guessed easily. They are also visible in some URLs.
campfire(prod):038> User.active
=>
[#<User:0x00007a444e940f18
id: 1,
name: "enoent",
created_at: "2025-09-06 11:59:41.505220000 +0000",
updated_at: "2025-09-06 14:08:08.788258000 +0000",
role: "administrator",
email_address: "[FILTERED]",
password_digest: "[FILTERED]",
active: true,
bio: "<s>ddqsdqsds</s>",
bot_token: nil>,
#<User:0x00007a444e940dd8
id: 2,
name: "test",
created_at: "2025-09-06 13:24:29.113250000 +0000",
updated_at: "2025-09-06 13:42:26.539909000 +0000",
role: "member",
email_address: "[FILTERED]",
password_digest: "[FILTERED]",
active: true,
bio: nil,
bot_token: nil>,
#<User:0x00007a444e940c98
The following request highlights the issue, as it allows an unauthenticated user to impersonate another user (here with ID 2) and post messages on their behalf:
POST /rooms/2/2-/messages HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0
Accept: text/vnd.turbo-stream.html, text/html, application/xhtml+xml
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 193
Hello ! I'm the test user, even though I'm not authenticated
The attached image shows that the message was successfully posted and appears to come from the "test" user.
Impact
An unauthenticated user can send arbitrary messages as any user, in rooms the impersonated user have access to.
Attachments

Context
Campfire is a chat product in the Basecamp family. Rooms hold messages, and messages can be posted by people as well as by bots. Bots are a first-class concept: they are allowed to send messages into rooms, but they must authenticate with a bot key before the application accepts the message.
The report concerns that bot authentication path. The researcher found that the check can be satisfied without knowing any real bot key, and that the resulting identity is that of an ordinary user record, which lets an unauthenticated attacker post messages as somebody else.
Setup
The proof request uses the Host: localhost:8000 header. The Rails console output in the report is labelled campfire(prod). No specific version numbers, accounts or tooling beyond a browser user agent and the Rails console are given.
The precondition for the attack is simply that the target has at least one active user whose ID can be guessed or observed. IDs are incremental and, per the report, also visible in some URLs, so this precondition is easy to meet.
Finding it
The starting point is the bot authentication function itself:
def authenticate_bot(bot_key)
bot_id, bot_token = bot_key.split("-")
active.find_by(id: bot_id, bot_token: bot_token)
end
The key is split on - into an ID and a token, and the application looks up an active user matching both. The researcher noticed that the split does not require a right-hand side. If the supplied bot_key is just an ID followed by the separator, for example 1-, then bot_token becomes nil. The lookup then runs with bot_token: nil, and it will match any active user record whose bot_token column is also nil.
That is the whole flaw: the code treats "no token supplied" as a value to compare against, rather than as a reason to reject the request. Any user who has never been issued a bot token has bot_token: nil, so the comparison succeeds for them.
To confirm that such records exist and that IDs are predictable, the researcher queried the console:
campfire(prod):038> User.active
=>
[#<User:0x00007a444e940f18
id: 1,
name: "enoent",
created_at: "2025-09-06 11:59:41.505220000 +0000",
updated_at: "2025-09-06 14:08:08.788258000 +0000",
role: "administrator",
email_address: "[FILTERED]",
password_digest: "[FILTERED]",
active: true,
bio: "<s>ddqsdqsds</s>",
bot_token: nil>,
#<User:0x00007a444e940dd8
id: 2,
name: "test",
created_at: "2025-09-06 13:24:29.113250000 +0000",
updated_at: "2025-09-06 13:42:26.539909000 +0000",
role: "member",
email_address: "[FILTERED]",
password_digest: "[FILTERED]",
active: true,
bio: nil,
bot_token: nil>,
#<User:0x00007a444e940c98
The output shows sequential IDs starting at 1, an administrator at ID 1 and a member called test at ID 2, both active and both with bot_token: nil. Because IDs are incremental and appear in some URLs, an attacker does not need console access to enumerate them.
Exploitation
Step 1: craft a bot key with no token
Take a valid user ID and append the separator with nothing after it. For user ID 2 the key is 2-. When split, this yields bot_id = "2" and bot_token = nil, which matches the test user because that user's bot_token is nil.
Step 2: post a message to a room with that key
The researcher sent the following request, with no session or other authentication:
POST /rooms/2/2-/messages HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0
Accept: text/vnd.turbo-stream.html, text/html, application/xhtml+xml
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 193
Hello ! I'm the test user, even though I'm not authenticated
The path carries the room ID (2) and the forged bot key (2-) in the position where the bot credential is expected. The body is the message text. The Accept header asks for Turbo Stream, HTML or XHTML responses.
Step 3: observe the result
The message was accepted and posted. The attached screenshot shows it appearing in the room attributed to the test user.

The screenshot shows the message was posted and appears to come from the test user.
Root cause
The authentication function conflates two different situations: a token that was supplied and happens to be nil, and a token that was never supplied at all. Splitting "2-" on - produces a two-element array whose second element is nil, and find_by(id: bot_id, bot_token: nil) is a perfectly valid query that matches every active user with a null bot_token.
Existing defences did not help because the lookup is the defence. There is no separate check that a token was present, no rejection of empty or malformed keys, and no requirement that the matched user actually be a bot with a non-null token. The active scope only filters on the active flag, so it does not narrow the result to bot accounts. Users who have never been issued a bot token have bot_token: nil, so the query matches them.
Impact
An unauthenticated user can send arbitrary messages as any user, in rooms the impersonated user has access to. The attacker chooses the content and the identity; the only constraint stated is that the target room must be one the impersonated account can reach. Since IDs are incremental and visible in some URLs, the attacker can enumerate candidate IDs and try each one with the trailing separator until a message is accepted.
The report does not describe any further actions beyond posting messages, such as reading history or performing administrative operations as the impersonated user.
Fix
The report does not state what was changed.
Variants to test
- Trailing separator on other token formats. Anywhere a credential is split into parts, try supplying only the left-hand side plus the separator. A positive result is a successful authenticated action with no real secret.
- Empty string instead of nil. Try
1-and also forms that produce an empty string rather thannil, depending on how the language's split behaves. A positive result is the same impersonation with a different payload shape. - Other null columns used in lookups. Look for authentication queries that compare a user-supplied value against a column that is null for most accounts, such as an optional API token or device identifier. A positive result is a match against an account that never set that value.
- ID enumeration against message endpoints. Walk sequential IDs against room message endpoints with the forged key. A positive result is messages appearing under different user names.
- Administrator IDs. Try IDs belonging to administrators, as the console output shows an administrator at ID 1. A positive result is a message posted as an administrator in a room that account can access.
Hunting notes
This class of bug hides in authentication helpers that parse a compound credential and then use the parsed parts directly in a database query. The signal during recon is any feature that accepts a key of the form id-token, especially where the ID is a sequential primary key and the token is optional for normal accounts. Console or debug output that shows bot_token: nil on ordinary users is a strong hint that a missing token will match.
To show impact, the researcher did three things: demonstrated the parsing flaw in the code, showed real records with null tokens and sequential IDs, and sent a single unauthenticated request that produced a visible message under another user's name. The screenshot of the posted message is what turns the code reading into a demonstrated impersonation.
What happened, in plain words
Campfire is a chat product in the Basecamp family. Think of it as a set of chat rooms, like group conversations in any messaging app. People post messages into rooms, and so can bots: automated accounts that send messages on their own, for example to announce something or to connect another tool to the chat.
Bots are allowed to send messages into rooms, but they must authenticate with a bot key. A bot is allowed to send messages into a room, but before the application accepts the message it wants proof that the sender really is that bot. That proof is called a bot key, a short secret string the bot presents with each message.
The researcher found that this proof can be faked. You do not need to know any real bot key. You only need to know the numeric ID of an ordinary user account, and those IDs are easy to guess because they count up one by one. With a specially shaped fake key, the application accepts the message and shows it as if it came from that user. So an attacker who is not logged in at all can post messages pretending to be somebody else.
Background you need
A few ideas come up again and again below, so here they are from zero.
A web request. When you type an address into your browser and press Enter, or click a button on a page, your browser sends a request to a server. The request has a method (such as GET to fetch something or POST to send something), a path (which part of the site you want), some headers (extra information about the request) and sometimes a body (the data you are sending). The server replies, and the browser shows you the result. Every action you take on a website is really a series of these requests.
An API. An API is the part of a website that accepts requests and returns data, without the pretty page around it. Think of a restaurant: the dining room is the website you see, and the kitchen door where orders are handed in is the API. The kitchen does not care whether you are sitting at a table or phoning in; it just processes the order. Attackers like APIs because you can talk to them directly, skipping the website's buttons and forms.
Authentication. Authentication is how a site checks who you are. When you log in with a username and password, the site gives your browser something to carry around so it recognises you on the next request. That something is often a cookie (a small piece of data your browser stores and sends back automatically) or a token (a string that stands in for your login). If a request arrives without a valid cookie or token, the site should treat it as coming from a stranger.
A bot key. In Campfire, a bot proves itself with a bot key instead of a login. The application splits the bot key on a hyphen into an ID and a token. The application splits the string on the hyphen and looks up a matching account.
IDs. Every account in a database usually has an ID, a number that identifies it. In many systems these numbers are incremental: the first account is 1, the next is 2, and so on. That makes them predictable. If you can see one ID, you can guess the others by counting. The report also notes that IDs are visible in some URLs, so you do not even need to guess blindly.
The vulnerability class. This bug is an authentication flaw, specifically an improper authentication issue. The application has a check, but the check can be satisfied without the secret it is supposed to require. The everyday comparison: a bouncer at a door asks for a membership card and checks the card number against a list. If you hand over a blank card, and the bouncer's rule is "does the number on the card match a number on the list", a blank card matches every entry whose number field is also blank. The bouncer lets you in because the check was written to compare values, not to reject missing ones.
Setting the scene
The proof request uses the Host header localhost:8000, and localhost is the standard name a computer uses for itself. You can see this in the proof request below: the Host header says localhost:8000, and localhost is the standard name a computer uses for itself.
The database records were inspected in the Rails console. The Rails console is an interactive prompt where a developer can type commands and see what is in the database. The prompt in the output is labelled campfire(prod), which is the name given to that console session.
The report does not give version numbers, specific accounts or tooling beyond a browser user agent and the Rails console.
The only precondition for the attack is that the target has at least one active user whose ID can be guessed or seen. Since IDs count up and appear in some URLs, that condition is easy to meet.
Finding it
The starting point is the function that checks a bot key. Here it is as it appears in the report:
def authenticate_bot(bot_key)
bot_id, bot_token = bot_key.split("-")
active.find_by(id: bot_id, bot_token: bot_token)
end
Line by line:
def authenticate_bot(bot_key)defines a function calledauthenticate_botthat takes one input, the bot key supplied by whoever is sending the message.bot_id, bot_token = bot_key.split("-")cuts the key into pieces wherever there is a hyphen, and puts the first piece intobot_idand the second intobot_token. So a key like7-abc123becomesbot_id = "7"andbot_token = "abc123".active.find_by(id: bot_id, bot_token: bot_token)searches the active users for a record whose ID equalsbot_idand whose stored bot token equalsbot_token. If it finds one, that account is treated as the authenticated bot.
The researcher noticed that the split does not require anything on the right-hand side of the hyphen. If the supplied key is just an ID followed by the hyphen, for example 1-, then bot_token becomes nil. In Ruby, nil means "nothing" or "no value". The lookup then runs with bot_token: nil, and it will match any active user record whose stored bot_token is also nil.
That is the whole flaw. The code treats "no token was supplied" as a value to compare against, instead of as a reason to refuse the request. Any user who has never been issued a bot token has bot_token: nil, so the comparison succeeds for them.
To confirm that such records exist and that IDs are predictable, the researcher queried the console:
campfire(prod):038> User.active
=>
[#<User:0x00007a444e940f18
id: 1,
name: "enoent",
created_at: "2025-09-06 11:59:41.505220000 +0000",
updated_at: "2025-09-06 14:08:08.788258000 +0000",
role: "administrator",
email_address: "[FILTERED]",
password_digest: "[FILTERED]",
active: true,
bio: "<s>ddqsdqsds</s>",
bot_token: nil>,
#<User:0x00007a444e940dd8
id: 2,
name: "test",
created_at: "2025-09-06 13:24:29.113250000 +0000",
updated_at: "2025-09-06 13:42:26.539909000 +0000",
role: "member",
email_address: "[FILTERED]",
password_digest: "[FILTERED]",
active: true,
bio: nil,
bot_token: nil>,
#<User:0x00007a444e940c98
What this shows:
campfire(prod):038>is the console prompt, waiting for a command.User.activeasks the application for all users that are currently active, meaning not disabled or deleted.=>marks the start of the answer.- Each
#<User:...>block is one user record. The long hexadecimal string afterUser:is just an internal memory reference, not something meaningful to an attacker. - The first record has
id: 1, the nameenoent, the roleadministrator,active: trueandbot_token: nil. - The second record has
id: 2, the nametest, the rolemember,active: trueandbot_token: nil. - The third record is cut off in the report, but it shows the list continues.
The important observations are that IDs are sequential starting at 1, that an administrator sits at ID 1 and a member called test at ID 2, that both are active, and that both have bot_token: nil. Because IDs are incremental and appear in some URLs, an attacker does not need console access to work them out.
Exploitation
Step 1: craft a bot key with no token
Take a valid user ID and append the hyphen with nothing after it. For user ID 2 the key is 2-. When the application splits it, it gets bot_id = "2" and bot_token = nil. That matches the test user, because that user's stored bot_token is nil. The attacker has produced a key that passes the check without knowing any secret.
Step 2: post a message to a room with that key
The researcher then sent the following request, with no session and no other authentication:
POST /rooms/2/2-/messages HTTP/1.1
Host: localhost:8000
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0
Accept: text/vnd.turbo-stream.html, text/html, application/xhtml+xml
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Content-Length: 193
Hello ! I'm the test user, even though I'm not authenticated
Line by line:
POST /rooms/2/2-/messages HTTP/1.1is the request line.POSTmeans "I am sending data to be stored". The path/rooms/2/2-/messagessays: in room2, post a message, and the2-in the middle is the forged bot key, sitting in the position where the bot credential is expected.HTTP/1.1is the version of the protocol being spoken.Host: localhost:8000tells the server which site is being addressed.localhostis the researcher's own machine and8000is the port, the numbered door on that machine where the application listens.User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:142.0) Gecko/20100101 Firefox/142.0identifies the browser that sent the request. Here it claims to be Firefox on Linux.Accept: text/vnd.turbo-stream.html, text/html, application/xhtml+xmllists the response formats the client can handle. Turbo Stream is a format the application's own front end uses to update a page without a full reload, and HTML and XHTML are ordinary web pages.Content-Type: application/x-www-form-urlencoded;charset=UTF-8says the body is form data, the same format a browser uses when you submit a form, encoded in UTF-8 characters.Content-Length: 193states how many bytes the body contains, so the server knows where the body ends.- The blank line separates the headers from the body.
Hello ! I'm the test user, even though I'm not authenticatedis the body: the message text itself. The wording is the researcher's own note that no login was used.
The path carries the room ID (2) and the forged bot key (2-) where the bot credential belongs. The body is the message. The Accept header lists the response formats the client can handle.
Step 3: observe the result
The message was accepted and posted. The attached screenshot shows it appearing in the room attributed to the test user.

The screenshot shows the message was posted and appears to come from the test user.
Root cause
The authentication function mixes up two different situations: a token that was supplied and happens to be nil, and a token that was never supplied at all. Splitting "2-" on the hyphen produces a two-element result whose second element is nil, and find_by(id: bot_id, bot_token: nil) is a perfectly valid query that matches every active user with a null bot_token.
Existing defences did not help because the lookup is the defence. There is no separate check that a token was present, no rejection of empty or malformed keys, and no requirement that the matched user actually be a bot with a non-null token. The active scope only filters on the active flag, so it does not narrow the result to bot accounts. Users who have never been issued a bot token have bot_token: nil, so the query matches them.
Impact
An unauthenticated user can send arbitrary messages as any user, in rooms the impersonated user has access to. The attacker chooses the content and the identity. The only constraint stated is that the target room must be one the impersonated account can reach. Since IDs are incremental and visible in some URLs, the attacker can try candidate IDs one after another with the trailing hyphen until a message is accepted.
The report does not describe any further actions beyond posting messages, such as reading history or performing administrative operations as the impersonated user.
Fix
Variants to test
- Trailing separator on other token formats. Anywhere a credential is split into parts, try supplying only the left-hand side plus the separator. A positive result is a successful authenticated action with no real secret.
- Empty string instead of nil. Try
1-and also forms that produce an empty string rather thannil, depending on how the language's split behaves. A positive result is the same impersonation with a different payload shape. - Other null columns used in lookups. Look for authentication queries that compare a user-supplied value against a column that is null for most accounts, such as an optional API token or device identifier. A positive result is a match against an account that never set that value.
- ID enumeration against message endpoints. Walk sequential IDs against room message endpoints with the forged key. A positive result is messages appearing under different user names.
- Administrator IDs. Try IDs belonging to administrators, as the console output shows an administrator at ID 1. A positive result is a message posted as an administrator in a room that account can access.
Hunting notes
This class of bug hides in authentication helpers that parse a compound credential and then use the parsed parts directly in a database query. The signal during recon is any feature that accepts a key of the form id-token, especially where the ID is a sequential primary key and the token is optional for normal accounts. Console or debug output that shows bot_token: nil on ordinary users is a strong hint that a missing token will match.
To show impact, the researcher did three things: demonstrated the parsing flaw in the code, showed real records with null tokens and sequential IDs, and sent a single unauthenticated request that produced a visible message under another user's name. The screenshot of the posted message is what turns the code reading into a demonstrated impersonation.
Glossary
- API: the part of a website that accepts requests and returns data, without the page around it; the kitchen door where orders are handed in.
- Authentication: the process of proving who you are to a site, usually with a password, cookie or token.
- Bot: an automated account that sends messages or performs actions without a person typing each one.
- Bot key: the credential a bot presents in Campfire, made of a user ID and a secret token joined by a hyphen.
- Cookie: a small piece of data a site stores in your browser, which the browser sends back automatically on later requests.
- Header: extra information attached to a web request, such as the host, the browser type or the accepted response formats.
- Host header: the header that says which site the request is addressed to;
localhostmeans the same machine. - HTTP: the protocol browsers and servers use to exchange requests and responses.
- ID: a number that identifies a record in a database; in this report IDs count up one by one.
- Incremental ID: an ID that increases by one for each new record, making it predictable.
- localhost: the standard name a computer uses to refer to itself.
- Method: the verb of a request, such as
GETto fetch orPOSTto send data. - nil: the Ruby value meaning "nothing" or "no value".
- Path: the part of a URL that says which resource is being requested, such as
/rooms/2/2-/messages. - Port: a numbered door on a machine where a service listens, such as
8000. - POST: an HTTP method used to send data to the server, for example to create a message.
- Rails: a web framework whose console lets a developer inspect the database interactively.
- Rails console: an interactive prompt where a developer types commands and sees database records.
- Request body: the data sent along with a request, such as the text of a message.
- Scope: a filter applied to a database query, such as
active, which limits results to active users. - Token: a string that stands in for a login or proves an identity.
- Turbo Stream: a response format used by the application's front end to update a page without a full reload.
- Unauthenticated: not logged in, with no valid cookie or token proving identity.
- User-Agent: a header that identifies the browser or client that sent the request.
- UTF-8: a common character encoding that lets text include letters and symbols from many languages.
- Vulnerability class: a category of security bug, such as improper authentication, that groups similar mistakes.