SAML authentication bypass through unauthenticated `addSamlProvider` Meteor Call
An unauthenticated Meteor method allows an attacker to add a SAML provider setting that disables certificate validation. This lets the attacker log in as any user, including administrators, by sending a forged SAML response.
Originally disclosed on HackerOne
- Triaged in 12 hours
- Fixed in 6 days
- Disclosed after 37 days
Summary: Rocket.Chat exposes an unauthenticated Meteor method addSamlProvider, which allows disabling SAML signature verification.
Description:
The addSamlProvider Meteor method sets a number of settings, among them a boolean flag that defaults to false:
export const addSamlService = function(name: string): void {
settings.add(`SAML_Custom_${ name }`, false, {
type: 'boolean',
group: 'SAML',
i18nLabel: 'Accounts_OAuth_Custom_Enable',
});
The provider name is entirely user-controlled in this case.
Secondly, if a SAML authentication provider does not have a certificate set, or the setting is falsy, no validation is performed:
private verifySignatures(response: Element, assertionData: ISAMLAssertion, xml: string): void {
if (!this.serviceProviderOptions.cert) {
return;
}
Releases Affected:
- all versions including
meteor-accounts-saml, i.e. 0.8.0 and later.
Steps To Reproduce (from initial installation to vulnerability):
On the login page of a Rocket.Chat instance supporting SAML authentication using a provider named Default (this is the default), run the following Meteor call:
Meteor.call("addSamlService", "Default_cert")
Then log in using an arbitrarily faked SAML response.
Suggested mitigation
- Remove the
addSamlProviderMeteor method. All callers of the underlying function are server-side, therefore it needs not be exposed to the client.
Impact
- An unauthenticated attacker can disable SAML certificate validation on an instance with SAML authentication enabled, and then log in as an arbitrary user with administrative privileges.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The addSamlProvider Meteor method is exposed to unauthenticated clients and lets them set a SAML provider name that causes the certificate setting to be missing or falsy, which makes the signature verification return early.
What the attacker needed
SAML authentication enabled; provider named Default (default)
The fix
The addSamlProvider Meteor method should be removed because all callers of the underlying function are server-side.
How it was found
- On the login page of a Rocket.Chat instance with SAML enabled, call the addSamlService Meteor method with a provider name that appends _cert.
- Log in using an arbitrarily faked SAML response.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
SAML is a way for websites to trust a separate login service. The site checks a digital signature to make sure the login message is genuine. Here, anyone could call a function that turned off that check, so a fake login message was accepted.
What is Access control?
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.