当前位置:网站首页>DiceCTF - knock-knock
DiceCTF - knock-knock
2022-06-30 14:19:00 【Ff. cheng】
Together nodejs subject , Given the source code and dockerfile, from dockerfile know nodejs Version is 17.4.0, One pastebin


Return can be xss, But it doesn't come back cookie, therefore , Audit the code
The code logic is simple flag stay notes[0] position , But because everyone returns token inequality , So I want to forge token Switch to id=0 It seems impossible
You can find token The main logic of generation depends on two parts
this.secret = `secret-${crypto.randomUUID}`;
and
return crypto.createHmac('sha256',this.secret).update(id.toString()).digest('hex');
When I want to use my nodejs14 Try to generate secret Exception found at

So I went to find it 17 Version of the online website , Found a loophole ,nodejs-online

randomUUID The lack of () Lead to this.secret For fixing , This is a forgery token The opportunity of
So it can be forged token
const crypto = require('crypto');
let secret = `secret-${crypto.randomUUID}`;
let id = 0;
console.log(crypto.createHmac('sha256', secret).update(id.toString()).digest('hex'));
Another manual method
Put the error message base64 code
console.log(btoa(`secret-${crypto.randomUUID}`));
Generate
c2VjcmV0LWZ1bmN0aW9uIHJhbmRvbVVVSUQob3B0aW9ucykgewogIGlmIChvcHRpb25zICE9PSB1bmRlZmluZWQpCiAgICB2YWxpZGF0ZU9iamVjdChvcHRpb25zLCAnb3B0aW9ucycpOwogIGNvbnN0IHsKICAgIGRpc2FibGVFbnRyb3B5Q2FjaGUgPSBmYWxzZSwKICB9ID0gb3B0aW9ucyB8fCB7fTsKCiAgdmFsaWRhdGVCb29sZWFuKGRpc2FibGVFbnRyb3B5Q2FjaGUsICdvcHRpb25zLmRpc2FibGVFbnRyb3B5Q2FjaGUnKTsKCiAgcmV0dXJuIGRpc2FibGVFbnRyb3B5Q2FjaGUgPyBnZXRVbmJ1ZmZlcmVkVVVJRCgpIDogZ2V0QnVmZmVyZWRVVUlEKCk7Cn0=
utilize hmac forge token

visit
url/note?id=0&token=7bd881fe5b4dcc6cdafc3e86b4a70e07cfd12b821e09a81b976d451282f6e264
FLAG:dice{1_d00r_y0u_d00r_w3_a11_d00r_f0r_1_d00r}
边栏推荐
- 可觀測,才可靠:雲上自動化運維CloudOps系列沙龍 第一彈
- 步骤详解 | 助您轻松提交 Google Play 数据安全表单
- Golang template (text/template)
- @Component use cases
- Observable, seulement fiable: première bombe de salon de la série cloudops d'exploitation et d'entretien automatisés dans le nuage
- “即服务”,企业数字化转型的必然选择
- Logiciel de récupération de données easyrecovery15 téléchargement
- Advanced usage of go language for loop break and continue
- In the digital age, XDR (extended detection and response) has unlimited possibilities
- 深入理解.Net中的线程同步之构造模式(二)内核模式3.内核模式构造物Mutex
猜你喜欢

提权扫描工具

Jetpack Compose 实现完美屏幕适配

MFQE 2.0: A New Approach for Multi-FrameQuality Enhancement on Compressed Video

On simple code crawling Youdao translation_ 0's problem (to be solved)

Flat shading with unity

XSS challenge (6-10) more detailed answers

What network security problems are exposed when a large-scale QQ number theft event occurs?

MySQL back to table query optimization

Google Earth Engine(GEE)——将字符串的转化为数字并且应用于时间搜索( ee.Date.fromYMD)

用Unity实现Flat Shading
随机推荐
org. json. The jsonobject object is converted to JSON, and JSON adds new elements. The value is obtained according to the JSON key. And list object format string to jsonarray
[redis series] redis learning 16. Redis Dictionary (map) and its core coding structure
DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703
Notes on reverse learning in the first week of winter vacation
Use of laravel repository mode
Getting started with shell Basics
Calculates the length of the last word in a string, separated by spaces
More than 20 years after Hong Kong's return, Tupu digital twin Hong Kong Zhuhai Macao Bridge has shocked
remote: Support for password authentication was removed on August 13, 2021. Please use a personal ac
PHP conditional operator
VisualStudio and SQL
单元测试效率优化:为什么要对程序进行测试?测试有什么好处?
I love network security for new recruitment assessment
Pit used by go language array type
Talk about Vue's two terminal diff algorithm, analysis of the rendering principle of the mobile terminal, and whether the database primary key must be self incremented? What scenarios do not suggest s
When SQL queries are performed in table storage, an error is reported when the primary key is added to the query result, and the query result exceeds 10W rows. Do you want to add multiple indexes to t
Introduction to reverse commissioning - VA and RVA conversion in PE 04/07
Flat shading with unity
Realize a simple LAN communication (similar to feiqiu)
Using docker to manage MySQL services under Windows