| Descripción | 1. SUMMARY
A vulnerability has been found in marketplacekit MarketplaceKit, master branch at commit 534aa0eb9981a42115bb139f79ae5433b4483a05 (2019-10-22); no official release or fixed build is available. Affected is the store function of app/Http/Controllers/Account/ProfileController.php, reachable via POST /account/edit_profile. The lat and lng request parameters are not validated by UpdateUserProfile::rules() and are interpolated directly into DB::raw("(GeomFromText('POINT($lat $lng)'))"), which leads to SQL injection (CWE-89). The assignment is a direct property write, so Eloquent mass-assignment protection does not apply. An authenticated, email-verified, non-administrator account can execute arbitrary SQL with the privileges of the application's database user, allowing reading and modification of arbitrary database content. The attack can be launched remotely; time-based and error-based oracles were confirmed on a default local installation.
2. AFFECTED
Vendor: marketplacekit
Product: MarketplaceKit (Laravel 5.6 based marketplace platform)
Repository: https://github.com/marketplacekit/marketplacekit
Affected revision: master branch, commit 534aa0eb9981a42115bb139f79ae5433b4483a05 (2019-10-22). This commit is the current HEAD of master; there is no official release/tag and no fixed build.
Affected endpoint: POST /account/edit_profile, parameters lat and lng. Route group auth + isVerified (routes/web.php:69), resource route at line 75.
Vulnerability class: CWE-89 SQL Injection
CVSS 3.1: AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H, Base 8.8 (High)
3. ROOT CAUSE
File: app/Http/Controllers/Account/ProfileController.php
Lines: 47-55
Role: lat and lng are read from the request (48-49) and interpolated into DB::raw (50).
File: app/Http/Requests/UpdateUserProfile.php
Lines: 24-29
Role: rules() contains only the username rule; lat and lng are unvalidated.
File: routes/web.php
Lines: 69, 75
Role: auth + isVerified middleware group and the edit_profile resource route.
Vulnerable code (line 50):
if($request->input('lat') && $request->input('lng')) {
$lat = $request->input('lat');
$lng = $request->input('lng');
$user->location = \DB::raw("(GeomFromText('POINT($lat $lng)'))");
$user->address = $request->input('location');
...
$user->save();
}
The injection point sits inside the single-quoted POINT(...) string literal of an UPDATE statement. Because the value is assigned as a direct property write rather than through fill(), Eloquent mass-assignment protection ($fillable) does not apply.
4. PREREQUISITES
- A registered account with users.verified = 1 (auth + isVerified middleware). No administrator privileges are required.
- A MySQL server providing GeomFromText semantics (MySQL 5.6/5.7, the 2018-era target of this application). MySQL 8 removed this function (error 1305), which aborts the statement before any injected expression is evaluated. For validation on MySQL 8.0.39, a stored-function shim restoring 5.6/5.7 semantics was used:
CREATE FUNCTION GeomFromText(t TEXT) RETURNS geometry DETERMINISTIC
RETURN ST_GeomFromText(t);
5. REPRODUCTION
A naive 1' AND (SELECT SLEEP(5)) AND ' payload does not work: MySQL strict mode raises error 1292 while coercing the leading POINT(1... string, before SLEEP is evaluated. The working bypass closes the string and parentheses early, adds a second assignment into another column, parks the template's trailing quote inside a lazy IF() ELSE branch that is never evaluated, and preserves the trailing native-prepared-statement placeholders (Laravel uses ATTR_EMULATE_PREPARES=false, so updated_at=? and id=? must survive; the tail must not be commented out).
Request:
POST /account/edit_profile HTTP/1.1
Host: target
Cookie: <authenticated verified-user session>
Content-Type: application/x-www-form-urlencoded
username=test&lat=1 5)')) , username = IF((SELECT NOT SLEEP(5)),1,('&lng=x
Resulting statement (captured from the application log):
UPDATE users SET location=(GeomFromText('POINT(1 5)')),
username=IF((SELECT NOT SLEEP(5)),1,(' x)')), updated_at=? WHERE id=4
Boolean data-conditioning for extraction, using server metadata only:
lat=1 5)')) , username = IF((SELECT ASCII(SUBSTRING(VERSION(),1,1))=56),(SELECT EXP(~0)),1), bio = IF(0,0,('&lng=x
6. CONFIRMED TECHNIQUES
Validated on a local installation (Laravel 5.6 / PHP 7.4.33 / MySQL 8.0.39 with the GeomFromText shim, registered and verified non-admin account):
- A benign baseline update (lat=1&lng=5) stores POINT(1 5) in users.location and completes in approximately 2.6 s. The bypass payload above produces the expected additional 5 s delay from SLEEP(5), observed in repeated runs at about 7.5 s.
- The injected second assignment persists its IF() branch value into users.username, verified directly in the database. This demonstrates write capability, not just inference.
- Error-based oracle: with a TRUE condition, IF(cond,(SELECT EXP(~0)),1) raises MySQL error 1690 "DOUBLE value is out of range in 'exp(~(0))'"; exactly one 1690 entry appears in storage/logs/laravel.log. With a FALSE condition the statement succeeds and no 1690 entry is logged. This yields an attacker-controlled boolean channel on database data.
- A conditional predicate on ASCII(SUBSTRING(VERSION(),1,1)) was used for both TRUE and FALSE branches. Example payloads extract only server metadata; no real user data was targeted.
- POST-save HTTP 500 responses in the log originate from an unrelated Redis-dependent queue listener after the database write and do not affect the injection.
A ready-to-run PoC script, the MySQL 8 compatibility shim and the verification transcript are provided as attachments and/or in the public advisory.
7. IMPACT
An authenticated, non-administrative user can execute arbitrary SQL with the privileges of the application's database user: reading data from any table (time-based and error-based extraction demonstrated), modifying data in any table (injected assignment into a second column demonstrated), and, depending on database privileges, writing files or escalating further within the application.
8. REMEDIATION
- Validate both inputs as numbers: add 'lat' => 'numeric', 'lng' => 'numeric' to UpdateUserProfile::rules(), or cast both with (float) before use.
- Build the geometry through a parameterized spatial expression (e.g. the Grimzy\LaravelMysqlSpatial Point type already used elsewhere in the codebase) instead of string interpolation into DB::raw.
9. REFERENCES
Project: https://github.com/marketplacekit/marketplacekit
Affected commit: https://github.com/marketplacekit/marketplacekit/commit/534aa0eb9981a42115bb139f79ae5433b4483a05
CWE-89: https://cwe.mitre.org/data/definitions/89.html
Vendor coordination notice (public, contains no exploit details): https://github.com/marketplacekit/marketplacekit/issues/165
Public advisory / PoC: not published yet. Full technical details are supplied in this submission and as attachments; the submitter will not publish them before 2026-11-22.
CVE: none assigned at time of submission; requested via VulDB as CNA.
10. VALIDATION ENVIRONMENT AND DISCLOSURE NOTES
All testing was performed in a local, isolated environment (127.0.0.1) against an unmodified checkout of the affected commit; the temporary environment was destroyed afterwards. Composer 1.10.27 was used because Composer 2 rejects the locked kylekatarnls/update-helper plugin API. A Redis-dependent listener was stubbed locally; the resulting POST-save 500 responses occur after the database write.
The project has no official release and master has received no new commits since 2019-10-22; the product should be considered end-of-life / no longer supported.
Vendor coordination: the maintainer was notified on 2026-11-08 through a public GitHub issue (https://github.com/marketplacekit/marketplacekit/issues/165) containing only a non-exploitable summary and no payload. No private reporting channel is available: the repository has no SECURITY.md, GitHub private vulnerability reporting is disabled, and master has received no commits since 2019-10-22. As of submission the issue is open with no maintainer response. Full technical details will not be published by the submitter before 2026-11-22; please keep the attached exploit material under embargo until then if possible. |
|---|