当前位置:网站首页>Reproduce 20 character short domain name bypass and XSS related knowledge points
Reproduce 20 character short domain name bypass and XSS related knowledge points
2022-07-29 03:16:00 【Jige yyds】
HTML Introduction to entity code
stay XHTML in , These reserved characters will immediately report an error if they appear in the label , however HTML The parser is too lazy , High fault tolerance , There will be no syntax errors
To use safely <,&,>," Equal character , You need to use a set of entity codes (entity encoding) Simple coding strategy
This set of HTML Entity coding strategy is based on & Symbol at the beginning , With ; Semicolon ending
stay XML There are only a few such codes in , And in the HTML in , There are hundreds of such entity codes , And common browsers support this usage
HTML There are several ways to encode
HTML Entity encoding , Format With & Symbol at the beginning , With ; Semicolon ending
HTML Entity coding reference manual
<textarea name="" id="textarea" cols="30" rows="10">
<img src="localhost">
</textarea>
The result is :
<img src="localhost">
Decimal ASCLL code , Format : To sign &# start , A semicolon ; ending
ascll Coding comparison table
<textarea name="" id="textarea" cols="30" rows="10">
<img src="localhost">
</textarea>
The result is :
<img src="localhost">
Unicode Character encoding , Format : To sign &# start , A semicolon ; ending
in addition , Below unicode The numbers of the coding reference table correspond to hexadecimal , But we need to convert it to decimal before displaying !
unicode Code reference
First turn on the 0022 The conversion to decimal is 0034;003D The conversion to decimal is 0061
<textarea name="" id="textarea" cols="30" rows="10">
<img src="localhost">
</textarea>
The result is :
<img src="localhost">
Hexadecimal ascll code , Format : With &#x start , A semicolon ; ending
Refer to the above ascll surface , But note that it needs to be converted to hexadecimal .
<textarea name="" id="textarea" cols="30" rows="10">
<img src="localhost">
</textarea>
The result is :
<img src="localhost">
Finally, take a look at several ways of writing
<textarea name="" id="textarea" cols="30" rows="10">
<@!<>
</textarea>
Last in textarea It shows that
<@!<>
That is to say < Is interpreted as "<“;@ Is interpreted as ”@“;! Is interpreted as ”!“;< Is interpreted as ”<“;> Is interpreted as ”>"
HTML Entity coding uses
Use inside the double quotation marks of the label
HTML Entity codes are not available for javascript
HTML The scope of entity code is HTML file , barring javscript execution environment , because javascript The parser of the execution environment is not HTML Parser !
Next, let's look at the code
document.write('<img src=@ οnerrοr=alert(123) />') // <img [email protected] οnerrοr=alert(123) />
console.log('<img src=@ οnerrοr=alert(123) />') // <img [email protected] οnerrοr=alert(123) />
console.log('\<img [email protected] οnerrοr=alert(123) \/\>') // <img [email protected] οnerrοr=alert(123) />_
- document.write Because the last string is output to html page , So it will still be html The entity is decoded into the corresponding tag
2. Because it's just js Print in the environment , So in the end, there was no html Entity encoding , The string doesn't change
3. because js The self decoding mechanism of will add backslashes to pure escape characters , So it is finally resolved to the form without backslash
URL analysis
URL The parser is also a state machine model , Characters coming in from the input stream can be guided URL The parser transitions to different states ;
URL Resource type must be ASCII Letter , Otherwise, it will enter “ No type ” state . Simply put, you can't write the protocol into code ; And in URL Use... During coding utf-8 Encoding type to encode every character , If you try to URL The connection is encoded by other encoding types ,URL The parser will not recognize correctly .
JavaScript analysis
JavaScript Analytical process and HTML The parsing process is a little different .JavaScript Language is a language whose content is irrelevant to language .
image \uXXXX The same characters are called Unicode Escape sequences . Escape sequences can be divided into 3 Parts of : Namely :
In a string : When Unicode When the escape sequence exists in the string , He will only be interpreted as a regular character , Not single quotes , Double quotation marks and other characters that can break the context of a string .
Identifier name : It will be decoded and interpreted as part of the identifier name .
Unicode Escape sequences are also allowed to be used in token names , As a character in the name ; But put the symbol before Unicode The escape sequence string cannot be used as a character in the identifier name . And will Unicode It is illegal to put an escape sequence string in an identifier name .
Control characters : For example, single quotation mark 、 Double quotes 、 Parentheses, etc. are not interpreted as control characters , It is decoded and parsed into an indicator name or string constant .7
So the conclusion is :Unicode Escape sequences are not treated as strings only in identifier names , And the encoded characters in the identifier name can be parsed normally .
from XSS Payload Learn browser decoding
(1)
<a href="%6a%61%76%61%73%63%72%69%70%74:%61%6c%65%72%74%28%31%29"></a>
Here the URL The encoding method will javascript:alert(1) Turned into the above
(2)
<a href="javascript:%61%6c%65%72%74%28%32%29">
First HTML Decoding in progress URL decode
<a href="javascript:alert(2)">
(3)
<a href="javascript%3aalert(3)"></a>
Use as before URL code
(4)
<div><img src=x οnerrοr=alert(4)></div>
It contains HTML Code content , In turn, think from the perspective of developers ,HTML Encoding is to display these special characters , Without interfering with normal DOM analysis , So the content in this will not become a img Elements , It's not going to be implemented .
(5)
<textarea><script>alert(5)</script></textarea>
<
yes RCDATA Elements (RCDATA elements), Can hold text and character references , Note that other elements cannot be accommodated ,HTML Decode and display directly RCDATA Elements (RCDATA elements) Include textarea and title, So I won't pop up(6)
<textarea><script>alert(6)</script></textarea>
Like the fifth ,textarea and title There will be HTML Decoding operation , But there will be no child elements , So I won't pop up
(7)
<button onclick="confirm('7');">Button</button>
here onclick Is the attribute value of the tag ( analogy 2 Medium href), Will be HTML decode , obtain
<button onclick="confirm('7');">Button</button>

(8)
<button onclick="confirm('8\u0027);">Button</button>
onclick The value in will be given to JS Handle , stay JS Only strings and identifiers can be used in Unicode Express , Nor can you encode symbols ,' Obviously not. ,JS Execution failure , So I won't pop up
(9)
<script>alert(9)</script>
script Belongs to the original text element (Raw text elements), Only text can be accommodated , Note that there are no character references , So directly by JS Handle , Here's all to the composition book ,,JS I can't recognize it , Execution failure , So you can't pop up
Original text elements (Raw text elements) Yes
(10)
<script>\u0061\u006c\u0065\u0072\u0074(10);</script>
Same as the second one above , Function name alert Belongs to identifier , Characters encoded without encoding symbols , Directly be JS perform , So you can pop up
(11)
<script>\u0061\u006c\u0065\u0072\u0074\u0028\u0031\u0031\u0029</script>
stay JS Only strings and identifiers can be used in Unicode Express , This encodes symbols ,JS Execution failure , Don't pop up
(12)
<script>\u0061\u006c\u0065\u0072\u0074(\u0031\u0032)</script>
There seems to be nothing wrong here , But here \u0031\u0032 When decoding, it will be decoded into a string 12, Notice the string , Not numbers , Words obviously need quotation marks ,JS Execution failure
(13)
<script>alert('13\u0027)</script>
Coded ‘ It's a symbol , So I can't pop up
(14)
<script>alert('14\u000a')</script>
\u000a stay JavaScript Inside is a new line , Namely \n, Although the line changed , But the quotation marks are all , Not encoded , It can be executed directly , So you can pop up
(15)
<a
href="javascript:%5c%75%30%30%36%31%5c%75%30%30%36%63%5c%75%30%30%36%35%5c%75%30%30%37%32%5c%75%30%30%37%34(15)"></a>
First use HTML Decoding and URL decode
javascript:\u0061\u006c\u0065\u0072\u0074(15)
distinguish JS agreement , Then from JS Module processing , Decode to get
javascript:alert(15)
summary
<script> and <style> Data can only have text , There will be no HTML Decoding and URL Decoding operation
<textarea> and <title> There will be HTML Decoding operation , But there will be no child elements
Other element data ( Such as div) And element attribute data ( Such as href) There will be HTML Decoding operation
Some properties ( Such as href) There will be URL Decoding operation , but URL The agreement in must be ASCII
JavaScript String and identifier Unicode decode
3. This machine builds galleryCMS Server for
open PHPstudy, take galleryCMS Put the file under the root file , And modify the configuration file

Open database , Add database galleryCMS
Go to the browser and refresh , Get into galleryCMS Webpage
In the source code, we change the limit length to 35
although xss-clean Filter a lot of tags , But he hasn't filtered it out < svg > label , So we use < svg> Label a test .


We found that we added successfully , So we use svg Tag to bypass , The next step is to solve the problem of character length

We can see that this is all 29 A character. , So we can only modify the length of the domain name , Replace three characters with one character , Used to bypass short domain names .
℠ expands to sm
㏛ expands to sr
st expands to st
㎭ expands to rad
℡ expands to tel
ff expands to ff
When I was there kali Prepare to install beef-xss When , Errors always occur during installation , I also tried to use apt-get update to update 
But the update speed is too slow , Then I gave up ......
边栏推荐
- CentOS install mysql8
- C陷阱与缺陷 第3章 语义“陷阱” 3.1 指针与数组
- C陷阱与缺陷 第2章 语法“陷阱” 2.6 “悬挂”else引发的问题
- C traps and defects Chapter 3 semantic "traps" 3.3 array declaration as parameters
- [freeswitch development practice] unimrcp compilation and installation
- Chapter 09_ Use of performance analysis tools
- Wechat's crazy use of glide - life cycle learning
- 国产ERP有没有机会击败SAP ?
- GJB常见混淆概念
- STC MCU drive 1.8 'TFT SPI screen demonstration example (including data package)
猜你喜欢

01-SDRAM:初始化模块的代码

万字详解 Google Play 上架应用标准包格式 AAB

CentOS install mysql8

今晚7:30 | 连界、将门、百度、碧桂园创投四位大佬眼中的AI世界,是继续高深还是回归商业本质?...
![[freeswitch development practice] media bug obtains call voice flow](/img/14/9a359403606c312b30733d4a015fa5.png)
[freeswitch development practice] media bug obtains call voice flow

ShardingSphere之水平分表实战(三)

Does domestic ERP have a chance to beat sap?

Score addition and subtraction of force deduction and brushing questions (one question per day 7/27)

基于单片机烟雾温湿度甲醛监测设计

Chapter 2 VRP command line
随机推荐
【C】 Array
C语言基础知识点汇总
C traps and defects Chapter 3 semantic "traps" 3.2 pointers to non arrays
3D高级渲染器:Artlantis studio 2021.2中文版
Practical guidance for interface automation testing (Part I): what preparations should be made for interface automation
2. Nodejs -- path (\dirname, \filname), URL URL, querystring module, mime module, various paths (relative paths), web page loading (interview questions *)
C traps and defects Chapter 3 semantic "traps" 3.3 array declaration as parameters
一种简单通用的获取函数栈空间大小的方法
复现20字符短域名绕过以及xss相关知识点
MYSQL入门与进阶(十四)
C陷阱与缺陷 第3章 语义“陷阱” 3.7 求值顺序
Score addition and subtraction of force deduction and brushing questions (one question per day 7/27)
GJB常见混淆概念
Object转String的几种方法
C language small project - address book (static version + dynamic version + file version)
正则表达绕过waf
Navicat new database
Engineering boy: under 20 years old, ordinary but not mediocre
Data truncation and estimation
Principle knowledge is useful