Skip to content
SQL injection Write-up Intermediate

SugarCRM (portal_get_related_notes) SQL Injection Vulnerability

The portal_get_related_notes SOAP function passed the order_by parameter into a SQL ORDER BY clause without proper sanitisation. A Portal API user could exploit this to inject SQL through that parameter.

karmainsecurity.com

Published on karmainsecurity.com

The vulnerability is located within the SOAP API, specifically into the portalgetrelatednotes() SOAP function. User input passed through the “orderby” parameter isn’t properly sanitized before being used to construct an “ORDER BY” clause of a SQL query from within the getnotesincontacts() or getnotesinmodule()…

The author, on karmainsecurity.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.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the order_by value was concatenated into an ORDER BY clause instead of being validated against a list of allowed column names.

Impact

A Portal API user could inject SQL through the order_by parameter, which may let them read or alter data beyond what their account allows.

What the attacker needed

A Portal API user account; access to the SOAP API

The fix

It should be fixed by validating order_by against a fixed allowlist of column names and using parameterised queries.

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 write-up has not been written yet. The Original tab links to the source.

A database query is built by gluing together text, and one piece of that text comes straight from the user. By putting extra database instructions into that piece, a user with a portal account can change what the query does. This is called SQL injection.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.