V8中的非预期

https://blog.keenan.top/2020/07/04/v8-exploit-basics/

d8的shell支持的命令
源码

// Creates a new execution environment containing the built-in
// functions.
v8::Local<v8::Context> CreateShellContext(v8::Isolate* isolate) {
  // Create a template for the global object.
  v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(isolate);
  // Bind the global 'print' function to the C++ Print callback.
  global->Set(isolate, "print", v8::FunctionTemplate::New(isolate, Print));
  // Bind the global 'read' function to the C++ Read callback.
  global->Set(isolate, "read", v8::FunctionTemplate::New(isolate, Read));
  // Bind the global 'load' function to the C++ Load callback.
  global->Set(isolate, "load", v8::FunctionTemplate::New(isolate, Load));
  // Bind the 'quit' function
  global->Set(isolate, "quit", v8::FunctionTemplate::New(isolate, Quit));
  // Bind the 'version' function
  global->Set(isolate, "version", v8::FunctionTemplate::New(isolate, Version));
  return v8::Context::New(isolate, NULL, global);
}

通过read读文件

d8> read('flag.txt');

通过import泄露文件

d8> import('flag.txt');

通过绝对路径可能会报错,用相对路径就可以了 ('../../../../../../flag.txt')

通过load泄露文件

d8> load();
d8> load('flag.txt');
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • v8引擎出现的原因 这里先说一下什么是编译型语言和解释性语言: 编译型语言: 在程序执行之前必须进行专门的编译过程...
    iyifei阅读 1,944评论 0 3
  • V8世界探险 (1) - v8 API概览 v8是Google开发的JavaScript引擎,自推出后就对js生态...
    Jtag特工阅读 4,936评论 1 11
  • 本文为翻译文章,因工作中遇到与V8引擎相关问题,网上相关文献大多为英文,故将遇到的个人觉得有价值的文献逐个翻译,如...
    BugTaoTi阅读 1,286评论 0 0
  • V8是由google公司开发的一款高性能、开源的javascript引擎,项目里需要使用V8来执行js,因此想要学...
    AndroidWorld阅读 3,048评论 0 1
  • Profile your web application with V8’s internal profiler ...
    iyifei阅读 376评论 0 0