SQL注入登录页面——Appointment
http一般在80端口
https一般在443端口
使用hackthebox靶机Appointment
一、开启vpn运行靶机
二、通过ICMP协议查看靶机是否存活
三、通过nmap扫描发现端口
-sC 使用默认脚本扫描 -sV 扫描版本 均为被认为是更具入侵性的 需要用到超级用户权限
发现80端口http服务开启,Apache版本为2.4.38,通过搜索引擎查看该版本的漏洞,发现不含任何已知的可以利用的漏洞
Apache HTTP Server是一个免费的开源应用程序,可以在物理或虚拟上运行网页网络服务器。它是最受欢迎的HTTP服务器之一,通常在标准HTTP端口上运行,例如端口 80 TCP、443 TCP 以及 HTTP 端口(如 8080 TCP 或 8000 TCP)上的端口。HTTP 代表超文本传输协议,它是用于传输超媒体的应用层协议文档,例如 HTML(超文本标记语言)
四、访问地址
http://10.129.110.71:80
发现登入表单
五、寻找子域名
尝试暴力破解
/home /login /contact /login/forgot 均无所发现,尝试使用gobuster工具
通过help查看gobuster工具使用方法
gobuster dir --url http://{ip}/ --wordlist {path}
dir:使用枚举
wordlist:字典
/usr/share/wordlists/dirb/common.txt
如图301为重定向,403为失败访问,200为成功访问
发现子域名/index.php,访问发现为登入页面
至此gobuster没有发现可以利用的子域名
六、尝试sql注入登入
sql注入漏洞的例子:
<?php
mysql_connect("localhost", "db_username", "db_password"); # Connection to the SQL
Database.
mysql_select_db("users"); # Database table where user information is stored.
$username=$_POST['username']; # User-specified username.
$password=$_POST['password']; #User-specified password.
$sql="SELECT * FROM users WHERE username='$username' AND password='$password'";
# Query for user/pass retrieval from the DB.
$result=mysql_query($sql);
# Performs query stored in $sql and stores it in $result.
$count=mysql_num_rows($result);
# Sets the $count variable to the number of rows stored in $result.
if ($count==1){
# Checks if there's at least 1 result, and if yes:
$_SESSION['username'] = $username; # Creates a session with the specified $username.
$_SESSION['password'] = $password; # Creates a session with the specified $password.
header("location:home.php"); # Redirect to homepage.
}
else { # If there's no singular result of a user/pass combination:
header("location:login.php");
# No redirection, as the login failed in the case the $count variable is not equal to
1, HTTP Response code 200 OK.
}
?>
#在其中表示注释语句,那么尝试利用用户名一栏注释掉密码需求,实现只用用户名就可以登入,
在username一栏写注入代码:admin'#
构造出:username='admin' #' and passwd = 'xxxxx'