If you use this code in a publication please cite the following paper:
This is a malware manipulation en for OpenAI's `gym.
OpenAI Gym is a toolkit for de and comparing reinforcement
learning algorithms. This makes it possible to write agents that learn
to manipulate PE files (e.g., malware) to achieve some objective
(e.g., bypass A on a reward provided by taking specific manipulation
actions.
Objective
======
Create an AI that learns through reinforcement learning which functionality-preserving transformations to make on a malware sample to break through / bypass machine learning static-analysis malware detection.
!Breakout
Basics
======
There are two basic concepts in reinforcement learning: the en (in our case, the malware sample) and the agent (namely, the algorithm used to change the en). The agent sends actions to the en, and the en replies with obser and rewards (that is, a score).
This repo provides an en for manipulating PE files and pro rewards that are based around bypassing AV. An agent can be deployed that ha been written for the rich gym framework. For example
* [recommended]
*
Setup
=====
The E framework is built on Python3.6 we recommend first creating a (details can be found [here]) with Python3.6 then performing the following actions ensure you have the correct python libraries:
[here]:
E also le a Library to Instrument Executable Formats aptly named [LIEF]. It allows our agent to modify the binary on-the-fly. To add it to your just one of their pre-built packages. Examples below:
[LIEF]:
Linux
OSX
Once completed ensure you' malware samples into the
If you are unsure where to acquire malware samples see the Data Acquisition section below. If you ha in the correct directory you can check to see if your en is correctly setup by running :
Note that if you are using Anaconda, you may need to
in order for LIEF to operate properly.
Data Acquisition
=====
If you have a API key, you may download samples to the gym_malware/gym_malware/en/samples/ using the Python script download_samples.py`.
Gym-Malware En
====
E pits a reinforcement agent against the malware en consisting of the following components:
* Action Space
* Independent Malware Classifier
* OpenAI framework malware en (aka gym-malware)
Action Space
----
The moves or actions that can be performed on a malware sample in our en consist of the following binary manipulations:
* append_zero
* append_random_ascii
* append_random_bytes
* remo
* upx_pack
* upx_unpack
* change_section_names_from_list
* change_section_names_to random
* modify_export
* remo
* break_optional_header_checksum
The agent will randomly select these actions in an attempt to bypass the classifier (info on default classifier below). Over time, the agent learns which combinations lead to the highest rewards, or learns a policy (*like an optimal plan of attack for any gi*).
Independent Classifier
----
Included as a default model is a [gradient boosted decision trees model] trained on 50k malicious and 50k benign samples with the following features extracted:
* Byte-level data (e.g. histogram and entropy)
* Header
* Section
* Import/Exports
[gradient boosted decision trees model]:
开发语言:Python
Star 数:637
该项目属于病毒分析方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕病毒分析相关项目展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。
从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。
1. 下载源码压缩包,解压到本地环境。
2. 根据项目类型准备对应的运行环境与依赖。
3. 按照 README 中的步骤完成配置与部署。
4. 在隔离的测试环境中运行验证,避免影响生产系统。
本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。
| 资源标题 | gym-malware - 病毒分析相关项目 |
| 所属分类 | 病毒分析 |
| 发布作者 | admin |
| 发布时间 | 2026-10-05 23:16:23 |
| 下载权限 | 免费下载 |
| 附件数量 | 2 个下载链接 |
| 浏览次数 | 234 |
| 讨论数量 | 0 |
| 主题状态 | 正常讨论中 |