Coder Social home page Coder Social logo

baidu-security / openrasp-v8 Goto Github PK

View Code? Open in Web Editor NEW
53.0 5.0 33.0 2.5 MB

Google V8 with OpenRASP builtins

License: Apache License 2.0

CMake 1.91% C++ 52.40% JavaScript 23.95% C 0.06% Go 3.59% Java 16.87% Shell 1.21%
v8 openrasp java php go javasc javascript plugin

openrasp-v8's Introduction

openrasp-v8

CI

Google V8 JavaScript engine with OpenRASP builtins, and bridges that are used to embed V8 within languages which are supported by OpenRASP.

Currently supported languages:

  • PHP
  • Java
  • Go

Features

OpenRASP attack detect engine in JavaScript

Full JavaScript runtime context of OpenRASP attack detect engine, with simple C++ interfaces and helpers.

Integrating openrasp-v8 in other languages only need several lines.

Lexical analyzer

Flex lexical analyzer is embeded in openrasp-v8 to tokenize sql and command strings. Just call RASP.sql_tokenize or RASP.cmd_tokenize

HTTP request

The http request method is RASP.request. It accepts a configure object and returns a promise. Just like the axios.

Platform independent

You can build and use it on different OS types, different OS versions and different OS archs.

For convenience of build, we have built some third-party libraries to static libraries:

  • Linux x64
  • Linux x86
  • Linux musl
  • OSX x64
  • Windows x64
  • Windows x86

For compatibility of Linux, most libraries will be staticly linked into openrasp-v8, even libc++. You can even use centos6 sysroot to force linker to link old version glibc.

Support multiple languages

We will continuely add more languages to our support list.

The language support briges are not just some C++ ports, but also the language specified native interfaces. Such as jni fo Java and cgo for Go.

Build

We use CMake to generate the files needed by your build tool (GNU make, Visual Studio, Ninja, etc.) for building openrasp-v8 and its language ports.

For example:

mkdir build
cd build
cmake -DENABLE_LANGUAGES=all ..
make
make test

The openrasp-v8 specified cmake variables:

  • ENABLE_LANGUAGES

    Cmake list of languages to build, or all for building all (base, php, java, go)

  • BUILD_TESTING

    Boolean option for whether the tests will be built

  • BUILD_COVERAGE

    Boolean option for whether the coverage will be built

openrasp-v8's People

Contributors

lixin1234qqq avatar spacelan avatar tangyouyi1513 avatar yinhuochong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

openrasp-v8's Issues

openrasp-php module fixed complier php ececuter throws error ld returned 1 exit status

when try fix openrasp -php module fix up php executer ,i moved agent/php5 dir to php-5.6.40/ext and cd php-5.6.40 then i execute buildconf --force,
and i will configure php ,the configure param is
./configure --prefix=/usr/local/php/php5 --with-config-file-path=/usr/local/php/php5/etc/ --with-config-file-scan-dir=/usr/local/php/php5/etc/php.d --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local/curl --enable-mbregex --enable-fpm --enable-mbstring --with-gd --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --enable-short-tags --enable-static --with-fpm-user --with-fpm-group --enable-ftp --with-freetype-dir=/usr/local/freetype --enable-openrasp --with-openrasp-v8=/home/brouseli/openrasp-master/openrasp-v8/ --with-gettext --enable-openrasp-remote-manager

finally when i make -j4 the result is
handlers.lo Zend/zend_objects_API.lo Zend/zend_default_classes.lo Zend/zend_execute.lo main/internal_functions_cli.lo sapi/cgi/cgi_main.lo sapi/cgi/fastcgi.lo -lcrypt -Wl,--start-group -Wl,/home/brouseli/openrasp-master/openrasp-v8/prebuilts/linux/lib64/libc++.a -Wl,/home/brouseli/openrasp-master/openrasp-v8/prebuilts/linux/lib64/libc++abi.a -Wl,/home/brouseli/openrasp-master/openrasp-v8/prebuilts/linux/lib64/libcrypto.a -Wl,/home/brouseli/openrasp-master/openrasp-v8/prebuilts/linux/lib64/libcurl.a -Wl,/home/brouseli/openrasp-master/openrasp-v8/prebuilts/linux/lib64/libssl.a -Wl,/home/brouseli/openrasp-master/openrasp-v8/prebuilts/linux/lib64/libv8_monolith.a -Wl,/home/brouseli/openrasp-master/openrasp-v8/prebuilts/linux/lib64/libz.a -Wl,--end-group -nodefaultlibs -lm -lc -lrt -lgcc_s -ldl -lpthread /home/brouseli/openrasp-master/openrasp-v8/build/php/libopenrasp_v8_php.a -lz -lcrypt -lrt -lstdc++ -lpng -lz -ljpeg -lcurl -lz -lrt -lm -lnsl -lxml2 -lcurl -lxml2 -lfreetype -lz -lxml2 -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lxml2 -lcrypt -o sapi/cgi/php-cgi
/usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/build/php/libopenrasp_v8_php.a(platform.cc.o): in function openrasp_v8::Platform::Startup()': /home/brouseli/openrasp-master/openrasp-v8/base/[platform.cc:36](http://platform.cc:36/): undefined reference to v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, std::__1::unique_ptr<v8::TracingController, std::__1::default_deletev8::TracingController >)'
/usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/build/php/libopenrasp_v8_php.a(platform.cc.o): in function openrasp_v8::Platform::Platform(int)': /home/brouseli/openrasp-master/openrasp-v8/base/[platform.cc:47](http://platform.cc:47/): undefined reference to v8::platform::tracing::TracingController::TracingController()'
/usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/base/platform.cc:48: undefined reference to v8::platform::tracing::TracingController::Initialize(v8::platform::tracing::TraceBuffer*)' /usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/build/php/libopenrasp_v8_php.a(platform.cc.o): in function openrasp_v8::Platform::PumpMessageLoop(v8::Isolate*, v8::platform::MessageLoopBehavior)':
/home/brouseli/openrasp-master/openrasp-v8/base/platform.cc:57: undefined reference to v8::platform::PumpMessageLoop(v8::Platform*, v8::Isolate*, v8::platform::MessageLoopBehavior)' /usr/bin/ld: /usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/build/php/libopenrasp_v8_php.a(platform.cc.o): in function openrasp_v8::Platform::Startup()':
/home/brouseli/openrasp-master/openrasp-v8/base/platform.cc:36: undefined reference to v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, std::__1::unique_ptr<v8::TracingController, std::__1::default_delete<v8::TracingController> >)' /usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/build/php/libopenrasp_v8_php.a(platform.cc.o): in function openrasp_v8::Platform::Platform(int)':
/home/brouseli/openrasp-master/openrasp-v8/base/platform.cc:47: undefined reference to v8::platform::tracing::TracingController::TracingController()' /usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/base/[platform.cc:48](http://platform.cc:48/): undefined reference to v8::platform::tracing::TracingController::Initialize(v8::platform::tracing::TraceBuffer*)'
/usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/build/php/libopenrasp_v8_php.a(platform.cc.o): in function openrasp_v8::Platform::PumpMessageLoop(v8::Isolate*, v8::platform::MessageLoopBehavior)': /home/brouseli/openrasp-master/openrasp-v8/base/[platform.cc:57](http://platform.cc:57/): undefined reference to v8::platform::PumpMessageLoop(v8::Platform*, v8::Isolate*, v8::platform::MessageLoopBehavior)'
/home/brouseli/openrasp-master/openrasp-v8/build/php/libopenrasp_v8_php.a(platform.cc.o): in function openrasp_v8::Platform::Startup()': /home/brouseli/openrasp-master/openrasp-v8/base/[platform.cc:36](http://platform.cc:36/): undefined reference to v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, std::__1::unique_ptr<v8::TracingController, std::__1::default_deletev8::TracingController >)'
/usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/build/php/libopenrasp_v8_php.a(platform.cc.o): in function openrasp_v8::Platform::Platform(int)': /home/brouseli/openrasp-master/openrasp-v8/base/[platform.cc:47](http://platform.cc:47/): undefined reference to v8::platform::tracing::TracingController::TracingController()'
/usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/base/platform.cc:48: undefined reference to v8::platform::tracing::TracingController::Initialize(v8::platform::tracing::TraceBuffer*)' /usr/bin/ld: /home/brouseli/openrasp-master/openrasp-v8/build/php/libopenrasp_v8_php.a(platform.cc.o): in function openrasp_v8::Platform::PumpMessageLoop(v8::Isolate*, v8::platform::MessageLoopBehavior)':
/home/brouseli/openrasp-master/openrasp-v8/base/platform.cc:57: undefined reference to `v8::platform::PumpMessageLoop(v8::Platform*, v8::Isolate*, v8::platform::MessageLoopBehavior)'
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status
make: *** [Makefile:270: sapi/cli/php] Error 1
make: *** Waiting for unfinished jobs....
make: *** [Makefile:306: sapi/cgi/php-cgi] Error 1
collect2: error: ld returned 1 exit status
make: *** [Makefile:283: sapi/fpm/php-fpm] Error 1

alpine 上编译错误

cmake --version
cmake version 3.13.0

CMake suite maintained and supported by Kitware (kitware.com/cmake).

g++ --version
g++ (Alpine 8.3.0) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bash-4.4# gcc --version
gcc (Alpine 8.3.0) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

bash-4.4# cat /etc/alpine-release
3.9.4

问题1
xxd 没有 -i 选项

xxd --help
BusyBox v1.29.3 (2019-01-24 07:45:07 UTC) multi-call binary.

Usage: xxd [OPTIONS] [FILE]

Hex dump FILE (or stdin)

-g N		Bytes per group
-c N		Bytes per line
-p		Show only hex bytes, assumes -c30
-l LENGTH	Show only first LENGTH bytes
-s OFFSET	Skip OFFSET bytes

经过转换后又出现编译错误。

4501586315570_ pic_hd

请问有没有编译好的alpine 版本的包?或者在alpine 上编译的手段

alpine 3.13.5 jdk 8u301

#A fatal error has been detected by the Java Runtime Environment:
#SIGSEGV (0xb) at pc=0x00007f754e616a29, pid=18, tid=0x00007f747fbff700
#JRE version: Java(TM) SE Runtime Environment (8.0_301-b09) (build 1.8.0_301-b09)
#Java VM: Java HotSpot(TM) 64-Bit Server VM (25.301-b09 mixed mode linux-amd64 compressed oops)
#Problematic frame:
#C [libopenrasp_v8_java.so+0x4afa29] openrasp_v8::Isolate::IsDead()+0x19

docker启动的时候偶尔会出现 不是每次都会出现这个导致docker起不来

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.