入门渗透:SQL注入登录页面——Appointment

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'

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

栉风沐雪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值