当前位置:网站首页>Handlebars dynamic adjustment
Handlebars dynamic adjustment
2022-06-23 02:44:00 【asura】
Link to the original text https://blog.p6.is/AST-Injection/
const Handlebars = require('handlebars');
Object.prototype.pendingContent = `<script>alert(origin)</script>`
const source = `Hello {{ msg }}`;
const template = Handlebars.compile(source);
console.log(template({"msg": "posix"})); // <script>alert(origin)</script>Hello posixAfter several rounds of dynamic debugging The following key positions have been found
Running program
From here f11 then shift + f11 Again f11
It is better not to f10 Will skip some steps
Get into compile
The previous step is to set some variables
We directly f5 To the next breakpoint
here opcode Altogether 8 individual
The first is appendContent
Here you can see appendContent Namely "<script>alert(origin)</script>
content Namely Hello
String concatenation
The key documents are
nodet1/node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js
continue f10 go back to opcodes loop
Walk a few opcode Have access to
pushSource
f11 Enter into pushSource
Mainly Give Way pendingContent become undefined
continue go back to
nodet1/node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js
function compileInput() {
var ast = env.parse(input, options),
environment = new env.Compiler().compile(ast, options),
templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
return env.template(templateSpec);
}
...
console.log(template({"msg":"posix"}));Print to console
边栏推荐
- Pnas: amygdala individual specific functional connectivity: Fundamentals of precision psychiatry
- Soft exam information system project manager_ Information system comprehensive testing and management - Senior Information System Project Manager of soft test 027
- This monitoring tool is enough for the operation and maintenance of small and medium-sized enterprises - wgcloud
- Cut! 39 year old Ali P9 saved 150million
- Analysis of web page status code
- How to customize a finished label template
- Interviewer: why does TCP shake hands three times and break up four times? Most people can't answer!
- 5g spectrum
- Supervisor multi process management exception automatic restart visual management
- How to design API return codes (error codes)?
猜你喜欢
![Buuctf misc-[actf freshman competition 2020]outline](/img/a4/ac9d14a69e0759d1e7c65740415bf7.jpg)
Buuctf misc-[actf freshman competition 2020]outline

6. template for integer and real number dichotomy

Unity official case nightmare shooter development summary < I > realization of the role's attack function

Performance test -- Jenkins environment construction for 15jmeter performance test

Understand GB, gbdt and xgboost step by step

Xgboost principle

Why is BeanUtils not recommended?

Spark broadcast variables and accumulators (cases attached)

Docker installs mysql5.7 and mounts the configuration file

5g spectrum
随机推荐
Deep learning environment configuration (I) installation of CUDA and cudnn
Goframe framework (RK boot): fast implementation of CSRF verification
The difference between script in head and body
5. concept of ruler method
Performance testing -- Interpretation and practice of 16 enterprise level project framework
Buuctf misc-[actf freshman competition 2020]outline
Markdown - enter a score (typora, latex)
Precision loss problem
Buuctf misc-[bjdctf2020] Nani
How to generate DataMatrix code in batch through TXT file
My good brother gave me a difficult problem: retry mechanism
Deep analysis of time complexity
February 3, 2022: a group of people (two or more) want to meet at the same place
PHP Base64 image processing Encyclopedia
A penetration of an internal self built shooting range
Canvas draw the clock
Deep scan log4j2 vulnerability using codesec code audit platform
Interviewer: what is the difference between SSH and SSM frameworks? How to choose??
Simple implementation of promise basic method
Quick sorting C language code + auxiliary diagram + Notes