{"id":17296451,"url":"https://github.com/spolu/gym_fuzz1ng","last_synced_at":"2025-07-07T18:38:00.340Z","repository":{"id":53902122,"uuid":"128192913","full_name":"spolu/gym_fuzz1ng","owner":"spolu","description":"OpenAI Gym environment for binary fuzzing based on afl","archived":false,"fork":false,"pushed_at":"2018-12-12T21:40:55.000Z","size":195,"stargazers_count":23,"open_issues_count":3,"forks_count":11,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T12:03:40.263Z","etag":null,"topics":["afl","deep-learning","fuzzing","openai-gym"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spolu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-05T10:47:03.000Z","updated_at":"2025-04-07T11:45:32.000Z","dependencies_parsed_at":"2022-08-13T03:50:30.030Z","dependency_job_id":null,"html_url":"https://github.com/spolu/gym_fuzz1ng","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spolu%2Fgym_fuzz1ng","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spolu%2Fgym_fuzz1ng/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spolu%2Fgym_fuzz1ng/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spolu%2Fgym_fuzz1ng/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spolu","download_url":"https://codeload.github.com/spolu/gym_fuzz1ng/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248877986,"owners_count":21176243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["afl","deep-learning","fuzzing","openai-gym"],"created_at":"2024-10-15T11:12:49.725Z","updated_at":"2025-04-14T12:03:46.475Z","avatar_url":"https://github.com/spolu.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gym-fuzz1ng\n\nOpenAI Gym[0] environment for binary fuzzing of a variety of libraries (libpng\nfor now), executables, as well as simpler examples.\n\nThe environment's engine is based on american fuzzy lop[1] (afl) and capable of\nthousands of executions per seconds for moderaltely sized executables.\n\nThe action space is the following:\n```\nBox(low=0, high=DICT_SIZE-1, shape=(INPUT_SIZE,), dtype='int32')\n```\n\n`DICT_SIZE` and `INPUT_SIZE` depend on the environnment and the underlying\nprogram to fuzz:\n- `DICT_SIZE` is the size of the dictionnary used to fuzz the program. `EOF` is\n  represented by `DICT_SIZE-1` and accessible by the `eof()` method on the\n  environment.\n- `INPUT_SIZE` is the input submitted for fuzzing it is fixed for each\n  environment and represents a maximal size for inputs to fuzz; smaller inputs\n  can be represented using `EOF`.\n\nThe environment simulates the following game:\n\n- each action submits a full input for fuzzing and returns the number of unique\n  transitions executed as reward.\n- if no new coverage is discovered by an input, the game is ended.\n\n(It is possible to simply call `step` independently of whether the game is done\nor not if you're just interested in easily executing binaries and retrieving\nthe associated coverage from Python. See also `step_raw`[2]).\n\nThe observation space is the following:\n```\nBox(low=0, high=255, shape=(256, 256), dtype='int32')\n```\n\nTo compute coverage, the underlying excecution engine assigns a random integer\nin `[0, 255]` to each simple block in the targeted binary.  The coverage is\nthen represented by a `256x256` matrix of `int8` representing the number of\ntime a transition was executed (note that this differs from how afl computes\ncoverage). Since `int8` are used for efficiency, the number of transitions can\nonly be within `[0, 255]` and wraps otherwise. This coverage matrix for the\nlast step execution is exactly what is returned as observation.\n\n- [0] https://gym.openai.com/\n- [1] http://lcamtuf.coredump.cx/afl/\n- [2] https://github.com/spolu/gym_fuzz1ng/blob/master/gym_fuzz1ng/envs/fuzz_base_env.py\n\n## Installation\n\n```\n# Note that running setup.py bdist_wheel takes a bit a time as it builds our\n# afl mod as well as the available targets.\npip install .\n\n# You may need to run the following commands as well as superuser.\necho core \u003e/proc/sys/kernel/core_pattern\n\n# You can then test that everything works by running our dummy example.\npython dummy_simple_bits.py\n```\n\n## Available environments\n\n### `FuzzLibPNGEnv`\n\nFuzzing environment for libpng-1.6.34 (recent).\n\n- **action_space**: `Box(low=0, high=283, shape=(1024,))` dictionary composed\n  of magic tokens, all 255 bytes and EOF. Maximum input size is 1024.\n\n### `FuzzSimpleBits-v0`\n\nFuzzing environment for the `simple_bits` executable (see\n[code](https://github.com/spolu/gym_fuzz1ng/blob/master/gym_fuzz1ng/mods/simple_bits-mod/simple_bits_afl.c)).\n\n- **action_space**: `Box(low=0, high=256, shape=(64,))` dictionary composed\n  all 256 bytes and EOF. Maximum input size is 64.\n\n### `FuzzSimpleLoop-v0`\n\nFuzzing environment for the `simple_loop` executable (see\n[code](https://github.com/spolu/gym_fuzz1ng/blob/master/gym_fuzz1ng/mods/simple_loop-mod/simple_loop_afl.c)).\n\n- **action_space**: `Box(low=0, high=256, shape=(8,))` dictionary composed\n  all 256 bytes and EOF. Maximum input size is 8.\n\n### `FuzzChecksum_{2,4,8}_{2,4,8}-v0`\n\nFuzzing environment for the `checksum_k_n` executable (see\n[code](https://github.com/spolu/gym_fuzz1ng/blob/master/gym_fuzz1ng/mods/checksum_k_n-mod/checksum_k_n_afl.c)).\n\n- **action_space**: `Box(low=0, high=256, shape=(8,))` dictionary composed\n  all 256 bytes and EOF. Maximum input size is 72.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspolu%2Fgym_fuzz1ng","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspolu%2Fgym_fuzz1ng","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspolu%2Fgym_fuzz1ng/lists"}