dongqian1893 2017-04-28 23:35
浏览 56
已采纳

XSS Works,但只有1个字

Maybe it's an weird question but I'll try to explain it as good I can. Currently I'm pentesting a website, for xss (cross site scripting). First I just tried, <script>alert(1)</script> and it resulted in [removed]alert(1)[removed], but also <scr<script> and those kinds of things, and I tried much more.

Now I finally got a working one: <input onfocus=alert("test") autofocus> and yes it really spits out 'test' but when i type alert(document.cookie) it already doesn't spit anything out anymore, also <input onfocus=alert("test lol") autofocus> doesn't spit anything out anymore, but like how can I now get the cookie? And why is it spitting out test, or ahihawiejawije but not ahjiahwe jijaja or test test, just one word? Also integers WORKS.

Also all html code, I try to in does work like <div> or <iframes> so how can I get the document.cookie spitted out on the page?

This is where I enter the XSS code: https://gyazo.com/d260e065a305941e92a414a321501134

And when I save it I can view it on this page: https://gyazo.com/723c1bff1d6fb7f3341a5b19cadcd264

But since the document.cookie one isn't working it'll just show an input bar, but when I replace the document.cookie just with "lol" it gives me this: "lol" (can't put more than 2 links bcz reputation) so it is working with lol.

So how is it possible that like one word, or one big word like AAAAAAAAA is working but not just 2 words like aaa aaa or document.cookie?

  • 写回答

1条回答 默认 最新

  • douxiangdiao6348 2017-04-29 01:44
    关注

    I'm just curious why printing out helloworld does work and hello world not.

    The space, because of the messed-up HTML, starts another attribute.

    Take a look in Chrome's inspector and the syntax highlighting makes it clear what's happening:

    <input onfocus=alert("test lol") autofocus>
    

    becomes:

    enter image description here

    Chrome attempts to fix the HTML, and lol") becomes another attribute. (I have no idea where the autofocus goes...) Nothing to do with the site's XSS protection (or lack thereof), just how the browser interprets the bad HTML.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?