浸透测验中的Node.js——使用C++插件躲藏实在代码

访客5年前黑客文章1146

在之前的文章《浸透测验中的Node.js——Downloader的完成》开源了一个运用Node.js完成Downloader的代码,扼要剖析在浸透测验中的运用思路。
Node.js的语法简略易懂,所以Node.js代码也很简略被剖析。
为了增加Node.js代码被剖析的难度,我的思路是运用Node.js的一个功用,将payload以C++插件的方式进行封装。
这样不光能够增加Node.js代码被剖析的难度,并且能够用C++代码来完成payload,已有的C++代码经过简略的修正即可运用,减小二次开发的本钱。
0x01 简介
本文即将介绍以下内容:
· C++插件简介
· 建立C++插件的开发环境
· C++插件代码实例
· 运用思路
· 防护主张
0x02 C++插件简介
Node.js C++插件是用C++编写的动态链接库,能够运用require()函数加载到Node.js中。运用V8供给的API,能够完成JavaScript和C++的相互调用,打通JavaScript和C++之间的接口。
官方文档:
https://nodejs.org/api/addons.html
运用实例:
1.编译成功一个C++插件,导出办法为:hello
2.运用Node.js调用C++插件导出办法的代码如下:
const addon = require('./addon.node');
addon.hello();
3.履行代码
node.exe test.js
0x03 建立C++插件的开发环境
1、Windows开发环境
测验体系:Win7sp1 x64
需求装置以下东西:
· .NET Framework 4.5.1或更高版别
· Python 2.7
· Visual Studio 2019或更高版别
详细建立流程如下:
1.装置.NET Framework 4.5.1
https://www.microsoft.com/en-US/download/details.aspx?id=5842
2.下载Node.js
https://nodejs.org/en/download/
3.运用Windows-Build-Tools主动装置依靠东西
https://github.com/felixrieseberg/windows-build-tools
cd c:
powershell
npm install --global windows-build-tools
假如装置失利,可选择手动装置以下东西:
· Python 2.7
· Visual Studio 2019或更高版别
4.装置node-gyp
https://github.com/nodejs/node-gyp
npm install -g node-gyp
2、Linux开发环境
wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz
tar xf node-v10.15.3-linux-x64.tar.xz
cd node-v10.15.3-linux-x64
cd bin
export PATH=/root/node-v10.15.3-linux-x64/bin:$PATH
./npm install -g node-gyp
注:需求增加环境变量指定node的方位(export PATH=/root/node-v10.15.3-linux-x64/bin:$PATH),否则在履行npm install会失利,提示/usr/bin/env: ‘node’: No such file or directory
实例演示:
1.hello.cc:
#include
namespace demo {
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::NewStringType;
using v8::Object;
using v8::String;
using v8::Value;
void Method(const FunctionCallbackInfo& args) {
  Isolate* isolate = args.GetIsolate();
  args.GetReturnValue().Set(String::NewFromUtf8(
      isolate, "world", NewStringType::kNormal).ToLocalChecked());
}
void Initialize(Local exports) {
  NODE_SET_METHOD(exports, "hello", Method);
}
NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize)
}  // namespace demo
2.binding.gyp
{
  "targets": [
    {
      "target_name": "addon",
      "sources": [ "hello.cc" ]
    }
  ]
}
3.经过node-gyp编译,生成插件
node-gyp configure
node-gyp build
注:能够合并成一条指令:
node-gyp configure build
Node.js支撑穿插编译,详细参数阐明可参阅:
https://www.npmjs.com/package/node-pre-gyp
Linux体系下生成Windows64位体系下运用的插件指令如下:
node-gyp configure build --target_arch=x64 --target_platform=win32
0x04 C++插件代码实例
在开发时,更好防止呈现if这种的条件判别句子,直接运用会导致编译过错。
1. 开释文件
#include
#include
namespace demo {
 using v8::FunctionCallbackInfo;
 using v8::Isolate;
 using v8::Local;
 using v8::Object;
 using v8::String;
 using v8::Value;
 void Method(const FunctionCallbackInfo& args) {
  FILE* fp;
  fopen_s(&fp, "new.txt", "ab+");
  char *buf = "123456";
  fwrite(buf, strlen(buf), 1, fp);
  fseek(fp, 0, SEEK_END);
  fclose(fp);
 }
 void init(Local exports) {
  NODE_SET_METHOD(exports, "hello", Method);
 }
 NODE_MODULE(NODE_GYP_MODULE_NAME, init)
}
2. 履行指令:
#include
namespace demo {
 using v8::FunctionCallbackInfo;
 using v8::Isolate;
 using v8::Local;
 using v8::Object;
 using v8::String;
 using v8::Value;
 void Method(const FunctionCallbackInfo& args) {
  system("powershell start calc.exe");
 }
 void init(Local exports) {
  NODE_SET_METHOD(exports, "hello", Method);
 }

[1] [2]  黑客接单网

相关文章

手机黑客软件_能在淘宝找黑客办事吗6-想找黑客怎么找

「手机黑客软件_能在淘宝找黑客办事吗6-想找黑客怎么找」假如长途获取 RMI 服务上的目标为 Reference 类或许其子类,则在客户端获取到长途目标存根实例时,可以从其他服务器上加载 class...

定位大师,推特上找黑客,找黑客删除群文件

Step 1Reference 中几个比较要害的特点:本次试验中,有两点需求打破,一是管理员口令,二是安全提示问题;username=admin&password=,updatexml(1,(...

针对HTTP的躲藏攻击面剖析(下)

在本系列文章的上集,咱们对现代Web运用架构中的躲藏体系以及躲藏服务进行了简略描述,并且介绍了本系列文章中所要运用的东西以及技能。在本系列文章的中集,咱们介绍了几种能够露出方针阻挠躲藏服务或躲藏体系的...

黑客接单2017_如何找一个黑客师傅

因为Chrome含有许多有状况的API,因而,在代码检查期间,人工检查这些API的话,难度非常大,这使得针对这些API的含糊测验技能,很简单找到有价值的缝隙。 在这方面,一个很好的比如便是AppCac...

手机黑客接单的平台_破解qq相册

· 继Facebook之后,全球网络广告商场另一巨子谷歌也清晰叫停数字钱银及ICO相关广告。 云端45 days ago, during 24×7 monitoring, #ManagedDefens...

浅谈弱口令的损害

故事要从一次困难的浸透测验说起(以下事例均为授权测验),实践证明,要想进行一次完美的浸透,网站缝隙跟弱口令更配! 简介 一般以为简单被别人(他们有可能对你很了解)猜测到或被破解东西破解的口令均为弱口令...