Coder Social home page Coder Social logo

chenlvtang / tinyrasp Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 1.0 56 KB

针对Java Web的RASP(Runtime application self-protection )漏洞防护系统。

License: Do What The F*ck You Want To Public License

Java 91.20% CSS 1.98% HTML 6.54% Batchfile 0.28%
cybersecurity information-security rasp waf web runtime-application-self-protection

tinyrasp's Introduction

WTFPL

TinyRASP

背景

背景

​ 传统的Web应用防护技术,如WAF(Web Application Firewall),因为是依据已定的则进行拦截,因此常常不能应对各种经过编码或是变形的攻击,同时规则的好坏对漏报、误报率影响较大,且无法对未披露利用方式的漏洞进行防御。

​ 因此,本文基于新兴的RASP技术,设计并实现了一个针对Java的漏洞防护系统。通过在漏洞利用的关键函数上埋下RASP探针,实现运行时实时检测和日志记录,在能检测到漏洞并实现告警页面重定向的同时,借助ELK(Elasticsearch、Logstash、Kibana)架构来对攻击者信息进行可视化管理以便溯源分析。最后,实验结果表明,本文设计的系统具有良好的拦截效果和兼容性,有一定的应用场景。

关键词:RASP;漏洞防护;Java Web;检测和拦截;ELK;日志可视化

系统架构

系统架构

1. 功能模块图

rasp系统功能模块

2. Agent架构图

rasp架构

3. Agent项目结构

rasp-Agent文件结构

4. 运行流程

rasp运行流程

5. 测试靶场拓扑图

rasp测试部署网络架构

成果及展望

成果及展望

✔漏洞防护:

  • RCE
  • 任意文件读取
  • SQL注入
  • 反序列化
  • JNDI注入
  • SpEL表达式注入

✔兼容性:

  • Spring Boot、Tomcat
  • Java17、Java8
  • 高低版本Servlet(高版本中包名为Jakarta而不是Javax)

✔攻击日志可视化管理:

  • 总日志浏览
  • 攻击信息可视化

❌防护规则还需完善(ORZ,目前非常简陋,后期赶时间,大多用的JRASP的规则,哈哈哈,Sorry

❌漏洞的覆盖面较低,目前完成六类漏洞

❌缺少一个用户配置读取模块,只能硬编码规则

❌做着做着发现,Byte Buddy其实好像比Javassit更好用,哈哈 ,但是不想重构

部署效果

部署效果

rasp.mp4

漏洞防护(部署前和部署后的对比图):

image-20230611134734197

兼容性测试:

image-20230611134912645

日志可视化:

image-20230611135144779

安装

1.准备工作:

git clone https://github.com/chenlvtang/TinyRASP.git

下载elasticsearch-8.7.0、kibana-8.7.0、logstash-8.6.2、mysql,并把Config目录中的配置文件放入对应的组件,手动依次开启服务,或使用run.bat批量开启。

在MySQL中创建spring用户,密码默认为spring,并创建spring数据库,将foo.sql文件导入Spring数据库。

2.Agent编译:

mvn install
mvn clean package shade:shade

3.JDK17启动SpringVulTest,JDK8启动TomcatVulTest,并添加JVM启动参数:

 -javaagent:/path/to/Agent.jar

运行测试环境

致谢

感谢各位师傅的技术博客、开源项目的慷慨大方,感谢ChatGPT,JRASP、OpenRASP,感谢感谢(●ˇ∀ˇ●)

协议

本项目遵循WTFPL协议,即"Do What The Fuck You Want To Public License"。

参考

http://www.jrasp.com/

https://github.com/jvm-rasp/jrasp-agent

https://github.com/baidu/openrasp

https://www.cnblogs.com/bitterz/p/15152287.html

https://www.cnblogs.com/Zzang/p/14845578.html

https://javasec.org/java-rasp/Hook.html

tinyrasp's People

Contributors

chenlvtang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

tdcoming

tinyrasp's Issues

挂载javaagent时报错

将Agent模块用maven打包成jar包供SpringVulTest模块挂载javaagent启动时报错。
报错如下:
image

打断点初步判断是ins.addTransformer添加转换器这一方法报错,不知道怎么解决好

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.