首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

web 狗之writeup-phone

鄙人不才,只能做个 web 狗了。那就好好学习 web 吧。拼命地刷 writeup 就好了。上题目,Phone number。提示只有 phone number is a good thing.

打开链接可以看到是一个登陆页面,查看源代码,没有什么东西。不过,这个页面还有个注册页面,注册页面有用户名密码以及 phone,查看其源代码也没有什么异常情况。这道题初步看来应该是一道 sql 注入题了,那么注入点在哪呢?当然是 phone 了(来自于上帝视角)。如果正经地来说还是因为题目的提示啦。

注入点的确就是 phone,不过是要使用 16进制数字。为什么呢?上帝告诉我的,我也不知道。好吧,接下来就是 sql 注入四步曲了,爆数据库名,爆表名,爆字段,最后查数据,拿 flag。是不是很开心!

正常用户

首先,我们首先注册一个正常用户,注册之后登录,可以看到页面。这里面有一个 check 的按钮,点击一下,可以看到页面提示 There only 369 people use the same phone as you。查看源代码,可以看到注释里面有一句话:听说admin的电话藏着大秘密哦,这也是一个小提示。这里面的369应该就是通过 sql 语句从数据库拿到的,语句可能就是类似于 这种的,从而查出和你电话号码一样的用户数了,那么我可以信誓旦旦地告诉你,这就是一个注入点啦!

数据库名

因为 phone 可能使用的是数字,所以这是一个数字型的注入。那么,我买可以随便注册一个用户名了,首先获取数据库名的语句是 ,把这个语句转化为16进制数字。将这个16进制数字作为 phone 来进行注册,这里注意的一个点就是,前台对于 phone 的长度做了限制, ,打开开发者工具设置大一点就可以了。注册成功之后,我么就可以看到:

Hello, txt1Your phone is 1 and 1 = 2 union select database().Click on the link and you'll know how many people use the same phone as you.

那么我们可以继续点击 check 按钮,页面显示

There only 0 people use the same phone as youThere only webdb people use the same phone as you

这里的 webdb 很显然就是数据库名了。

表名

接下来就是表名,这里比较麻烦的就是注入一次,就要注册一次,而且用户名不可以重复。算了,继续吧。构造查表名的语句: ,转化为16进制字符继续注册。再继续登录,点击 check:

There only 29891 people use the same phone as youThere only user people use the same phone as you

现在可以看出表名就是 user 了。

字段名

同样的配方,还是同样的味道。查询语句: ,点击 check,就会显示出列名:

There only 29893 people use the same phone as youThere only Host people use the same phone as youThere only User people use the same phone as youThere only Password people use the same phone as youThere only Selectpriv people use the same phone as youThere only Insertpriv people use the same phone as youThere only Updatepriv people use the same phone as youThere only Deletepriv people use the same phone as youThere only Createpriv people use the same phone as youThere only Droppriv people use the same phone as youThere only Reloadpriv people use the same phone as youThere only Shutdownpriv people use the same phone as youThere only Processpriv people use the same phone as youThere only Filepriv people use the same phone as youThere only Grantpriv people use the same phone as youThere only Referencespriv people use the same phone as youThere only Indexpriv people use the same phone as youThere only Alterpriv people use the same phone as youThere only Showdbpriv people use the same phone as youThere only Superpriv people use the same phone as youThere only Createtmptablepriv people use the same phone as youThere only Locktablespriv people use the same phone as youThere only Executepriv people use the same phone as youThere only Replslavepriv people use the same phone as youThere only Replclientpriv people use the same phone as youThere only Createviewpriv people use the same phone as youThere only Showviewpriv people use the same phone as youThere only Createroutinepriv people use the same phone as youThere only Alterroutinepriv people use the same phone as youThere only Createuserpriv people use the same phone as youThere only Eventpriv people use the same phone as youThere only Triggerpriv people use the same phone as youThere only Createtablespacepriv people use the same phone as youThere only ssltype people use the same phone as youThere only sslcipher people use the same phone as youThere only x509issuer people use the same phone as youThere only x509subject people use the same phone as youThere only maxquestions people use the same phone as youThere only maxupdates people use the same phone as youThere only maxconnections people use the same phone as youThere only maxuserconnections people use the same phone as youThere only plugin people use the same phone as youThere only authentication_string people use the same phone as youThere only id people use the same phone as youThere only username people use the same phone as youThere only phone people use the same phone as you

可以看到已经出现很多列名了,我们可以看到一些比较关键的列名,比如 username 以及 phone。

Flag

哈哈,最后一步了!Flag,马上就可以得到啦!由于之前的提示,我们可以知道 admin 的 phone 很重要,那么我们的语句就应该是,必须是: ,点击 check,显示:

There only 29894 people use the same phone as youThere only flag people use the same phone as youThere only 1555555 people use the same phone as youThere only 15500956659 people use the same phone as youThere only 1 people use the same phone as youThere only 123456 people use the same phone as youThere only 111111111111111 people use the same phone as youThere only 11111111111 people use the same phone as youThere only 12345678912 people use the same phone as youThere only 111111 people use the same phone as you

哈哈,常规套路,这个 wp 除了浏览器没有使用任何第三方工具即可完成,是不是很方便。这道题目是一道常规的 sql 注入题目,也算是入门了。

以上。

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20180824G0999D00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券