EC-CUBE / EC-CUBE/ec-cube2

[Security] 認可: IDOR・管理画面認証ロジックの改善

Open
#1,339 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
92
Forks
97
Avg merge
4d 2h
Merged PRs (30d)
9

Description

## 概要

お届け先住所編集におけるIDORの可能性と、管理画面の認証ロジックに不備が存在します。

## 深刻度: Medium

## 脆弱性詳細

### 1. お届け先住所編集の IDOR

**ファイル:** `data/class/pages/mypage/LC_Page_Mypage_DeliveryAddr.php` (L107, 144-154)

```php
// L107: リクエストパラメータをセッションに格納
$_SESSION['other_deliv_id'] = $_REQUEST['other_deliv_id'] ?? '';

// L145: セッション値を使用(GETパラメータではなく)
$arrOtherDeliv = $objAddress->getAddress($_SESSION['other_deliv_id'], $objCustomer->getValue('customer_id'));
```

**問題点:**
- `$_REQUEST['other_deliv_id']` の型キャストなしにセッションへ格納
- `$_GET` と `$_SESSION` の値に不整合が生じる可能性

**修正案:** 入力値を `(int)` でキャストし、セッションへの格納と使用を一貫させる

### 2. 管理画面認証ロジックの問題

**ファイル:** `data/class/pages/admin/LC_Page_Admin.php` (L148-151)

```php
if (stripos($_SERVER['REQUEST_URI'], rtrim(ROOT_URLPATH.ADMIN_DIR, '/')) === false) {
SC_Utils_Ex::sfIsSuccess(new SC_Session_Ex());
}
```

**問題点:**
- `stripos()` による文字列マッチングは、パス操作で回避される可能性
- ロジックが「ADMIN_DIR 以外からのリクエストに認証を要求」となっており、意図が不明確

**修正案:**
```php
$script_path = realpath($_SERVER['SCRIPT_FILENAME']);
$admin_path = realpath(HTML_REALDIR . ADMIN_DIR);
if (strpos($script_path, $admin_path) === 0) {
SC_Utils_Ex::sfIsSuccess(new SC_Session_Ex());
}
```

## 影響範囲

他ユーザーのデータへの不正アクセス、管理画面への認証バイパスの可能性(限定的)。

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.