Skip to content

Conversation

GabeClark99
Copy link

@GabeClark99 GabeClark99 commented Jun 19, 2025

  • Ported Radamsa mutators from Rust (original mutators can be found here)
  • Added unit tests for each mutator
  • Updated dependencies in kali Dockerfile
  • Included AFL++ mutators

Not all mutators are ready at this time (a list of the excluded mutators can be found here), but have been included for preliminary review.

Marc and others added 30 commits July 25, 2024 23:27
* Rand refactoring for 4.1.0

* DecrementByte Length Test

* TestByteDecremented

* DropByte TestBufferSize

* DropByte TestByteDropped

* FlipByte TestBufferSize

* FlibByte TestByteFlipped

* IncrementByte tests

* InsertByte tests

* fixed test name

* PermuteByte tests

TestPermuteTwoBytes currently failing due to buff having the same values as modBuff. Need to discuss if this is intended behavior for mutators in general.

* RandomizeByte TestRandomize

* RepeatByte

* misc cleanup

Added license header, removed superfluous comments, combined buffer length test cases

* buff_len, equality check

simplified buff length check by calling it once and storing the result; asserting buff != modBuff for buff_len where buff_len+1 == modBuff_len

* migrated to separate gtest binary

can now run our tests without piggybacking off of stock vmf

* DeleteLine

* the rest

* DeleteLine Exception Cases

tests for buffer size and buffer exists

* LineMutatorBase

stub class for LineMutatorBase and telling mutators to inherit

* ByteMutatorBase

stub class for ByteMutatorBase and telling mutators to inherit

* moved byte-specific helper function

GetRandomByteRepetitionLength is specific to byte mutators, so it should live in the new ByteMutatorBase instead

* Squashed commit of the following:

commit 95bdd87
Merge: 7b5d68d f3b3834
Author: GabeClark99 <[email protected]>
Date:   Fri Jan 24 17:14:18 2025 -0600

    Merge pull request #2 from crusoe112/mutator-bases

    Mutator bases

commit f3b3834
Author: GabeClark99 <[email protected]>
Date:   Fri Jan 24 15:27:20 2025 -0500

    moved byte-specific helper function

    GetRandomByteRepetitionLength is specific to byte mutators, so it should live in the new ByteMutatorBase instead

commit 9030be9
Author: GabeClark99 <[email protected]>
Date:   Fri Jan 24 15:22:54 2025 -0500

    ByteMutatorBase

    stub class for ByteMutatorBase and telling mutators to inherit

commit 86f1f26
Author: GabeClark99 <[email protected]>
Date:   Fri Jan 24 15:15:46 2025 -0500

    LineMutatorBase

    stub class for LineMutatorBase and telling mutators to inherit

* implemented Line struct

* implemented LineVector struct

* implemented LineList struct

* fixed typo

* DeleteLine typical usage tests

Intentionally excluding testing the code under the IsBinarish conditional because it doesn't appear to be correctly implemented in the original and may not be carried over into the new refactoring

* OneLine content test

* fixed DeleteLine buff tests

DeleteLine will append a null terminator, which was not accounted for previously.

* DeleteSequentialLines exception tests

* DeleteSequentialLines typical usage tests

* DuplicateLine exception tests

* Fixed testing buffer equality

also added buffer equality test to cases that needed it

* DuplicateLine OneLine

* DuplicateLine TwoLines and ThreeLines

* CopyLineCloseBy tests

* DuplicateLineMutatorTest fixes

- previous version assumed DuplicateLine operated like RepeatLine; this has been corrected
- simplified buffer content tests
- various cosmetic changes to improve readability

* RepeatLine Tests

* SwapLine tests

* Merge pull request #4 from crusoe112/Radamsa-Mutator-Refactoring

Splitting each mutator off into its own class

---------

Signed-off-by: GabeClark99 <[email protected]>
Co-authored-by: Marc Bohler <[email protected]>
Co-authored-by: crusoe112 <[email protected]>
* Rand refactoring for 4.1.0

* DecrementByte Length Test

* TestByteDecremented

* DropByte TestBufferSize

* DropByte TestByteDropped

* FlipByte TestBufferSize

* FlibByte TestByteFlipped

* IncrementByte tests

* InsertByte tests

* fixed test name

* PermuteByte tests

TestPermuteTwoBytes currently failing due to buff having the same values as modBuff. Need to discuss if this is intended behavior for mutators in general.

* RandomizeByte TestRandomize

* RepeatByte

* misc cleanup

Added license header, removed superfluous comments, combined buffer length test cases

* buff_len, equality check

simplified buff length check by calling it once and storing the result; asserting buff != modBuff for buff_len where buff_len+1 == modBuff_len

* migrated to separate gtest binary

can now run our tests without piggybacking off of stock vmf

* DeleteLine

* the rest

* DeleteLine Exception Cases

tests for buffer size and buffer exists

* LineMutatorBase

stub class for LineMutatorBase and telling mutators to inherit

* ByteMutatorBase

stub class for ByteMutatorBase and telling mutators to inherit

* moved byte-specific helper function

GetRandomByteRepetitionLength is specific to byte mutators, so it should live in the new ByteMutatorBase instead

* Squashed commit of the following:

commit 95bdd87
Merge: 7b5d68d f3b3834
Author: GabeClark99 <[email protected]>
Date:   Fri Jan 24 17:14:18 2025 -0600

    Merge pull request #2 from crusoe112/mutator-bases

    Mutator bases

commit f3b3834
Author: GabeClark99 <[email protected]>
Date:   Fri Jan 24 15:27:20 2025 -0500

    moved byte-specific helper function

    GetRandomByteRepetitionLength is specific to byte mutators, so it should live in the new ByteMutatorBase instead

commit 9030be9
Author: GabeClark99 <[email protected]>
Date:   Fri Jan 24 15:22:54 2025 -0500

    ByteMutatorBase

    stub class for ByteMutatorBase and telling mutators to inherit

commit 86f1f26
Author: GabeClark99 <[email protected]>
Date:   Fri Jan 24 15:15:46 2025 -0500

    LineMutatorBase

    stub class for LineMutatorBase and telling mutators to inherit

* implemented Line struct

* implemented LineVector struct

* implemented LineList struct

* fixed typo

* DeleteLine typical usage tests

Intentionally excluding testing the code under the IsBinarish conditional because it doesn't appear to be correctly implemented in the original and may not be carried over into the new refactoring

* OneLine content test

* fixed DeleteLine buff tests

DeleteLine will append a null terminator, which was not accounted for previously.

* DeleteSequentialLines exception tests

* DeleteSequentialLines typical usage tests

* DuplicateLine exception tests

* Fixed testing buffer equality

also added buffer equality test to cases that needed it

* DuplicateLine OneLine

* DuplicateLine TwoLines and ThreeLines

* CopyLineCloseBy tests

* DuplicateLineMutatorTest fixes

- previous version assumed DuplicateLine operated like RepeatLine; this has been corrected
- simplified buffer content tests
- various cosmetic changes to improve readability

* RepeatLine Tests

* SwapLine tests

* VMF v4.0.0 compatibility

* Add Determinism module set

AFLDeterministicFeedback: removes testcase execution time from fitness, and ignores hangs which alleviates some determinism issues
DeterministicTesterOutput: computes a running checksum of all generated testcase contents and IDs

* Merge pull request #4 from crusoe112/Radamsa-Mutator-Refactoring

Splitting each mutator off into its own class

* Mutator stubs

mutator names are subject to change once I figure out what each one is actually doing

* Renamed GetRandomByteRepetitionLength to be more generic

* RepeatByteSequence exception tests

* Added RepeatByteSequence

and its tests. also added missing exception tests to RepeatByte

* Fix RepeatByteMutator exception tests

copy-paste error

* Added DeleteByteSequence

* Renamed SwapLineOrder to PermuteLines

* Implemented PermuteLines

* minor cleanup

* Implemented InsertLine

renamed from InsertLineFromElsewhere

* Adjusted InsertLine minimum bytes requirement

* Dockerfile update

* VMF 5.0.0 Release

* Install location fix

Because we're dependent on both the installation of VMF as well as its test suite dependencies, we need to know where both are located. Ensuring that VMF installs to the default location allows us to know both without having to specify a path to the dependencies.

* VMF version fix

Temp fix until we update for 5.0.0. Clone with all version commits, not just latest, and checkout the 4.1.0 release commit.

* Minor changes

comment cleanup and fix error message

* Some 5.0.0 fixes

* ReplaceLine

renamed from ReplaceLineFromElsewhere

* working commit

compiles. OneNode segfault-ing, TwoNodes passes

* TreeMutatorBase and DeleteNode

the segfault disappeared on its own; I'm sure it's fine...

* working commit

segfault when referencing n->children in deleteNode. n->value is uninitialized?

* Generalized TreeMutatorBase

Switched to using 1:N trees instead of BSTs.

* Separated some TreeMutator logic into two functions

split finding node by index into its own function.
split node creation into its own function.

* Implemented DuplicateNode

* Implemented ReplaceNode

renamed from SwapNodes

* SwapNodes

renamed from SwapNodesPairwise

* RepeatPath

also moved GetRandomRepetitionLength from LineMutatorBase to MutatorBase, as Tree mutators also need it

* WidenCodePointMutator

* InsertUnicode

TODO: add tests for RadamsaByteMutatorBase::encode_utf8()

* ModifyTextNumber

* Remove XmlMutator

has no definition in the original rust

* working commit

pick up with findJumpPoints

* working commit

* FuseThis

* FuseNext

also moved Fuse helpers into their own file for easy reuse

* FuseOld

* working commit

pick up with testing

* AsciiBad

* Merge fix

* Squashed commit of the following:

commit 8762bf6
Author: GabeClark99 <[email protected]>
Date:   Tue Jun 17 09:09:39 2025 -0500

    4.1.0 release (#5)

    * Rand refactoring for 4.1.0

    * DecrementByte Length Test

    * TestByteDecremented

    * DropByte TestBufferSize

    * DropByte TestByteDropped

    * FlipByte TestBufferSize

    * FlibByte TestByteFlipped

    * IncrementByte tests

    * InsertByte tests

    * fixed test name

    * PermuteByte tests

    TestPermuteTwoBytes currently failing due to buff having the same values as modBuff. Need to discuss if this is intended behavior for mutators in general.

    * RandomizeByte TestRandomize

    * RepeatByte

    * misc cleanup

    Added license header, removed superfluous comments, combined buffer length test cases

    * buff_len, equality check

    simplified buff length check by calling it once and storing the result; asserting buff != modBuff for buff_len where buff_len+1 == modBuff_len

    * migrated to separate gtest binary

    can now run our tests without piggybacking off of stock vmf

    * DeleteLine

    * the rest

    * DeleteLine Exception Cases

    tests for buffer size and buffer exists

    * LineMutatorBase

    stub class for LineMutatorBase and telling mutators to inherit

    * ByteMutatorBase

    stub class for ByteMutatorBase and telling mutators to inherit

    * moved byte-specific helper function

    GetRandomByteRepetitionLength is specific to byte mutators, so it should live in the new ByteMutatorBase instead

    * Squashed commit of the following:

    commit 95bdd87
    Merge: 7b5d68d f3b3834
    Author: GabeClark99 <[email protected]>
    Date:   Fri Jan 24 17:14:18 2025 -0600

        Merge pull request #2 from crusoe112/mutator-bases

        Mutator bases

    commit f3b3834
    Author: GabeClark99 <[email protected]>
    Date:   Fri Jan 24 15:27:20 2025 -0500

        moved byte-specific helper function

        GetRandomByteRepetitionLength is specific to byte mutators, so it should live in the new ByteMutatorBase instead

    commit 9030be9
    Author: GabeClark99 <[email protected]>
    Date:   Fri Jan 24 15:22:54 2025 -0500

        ByteMutatorBase

        stub class for ByteMutatorBase and telling mutators to inherit

    commit 86f1f26
    Author: GabeClark99 <[email protected]>
    Date:   Fri Jan 24 15:15:46 2025 -0500

        LineMutatorBase

        stub class for LineMutatorBase and telling mutators to inherit

    * implemented Line struct

    * implemented LineVector struct

    * implemented LineList struct

    * fixed typo

    * DeleteLine typical usage tests

    Intentionally excluding testing the code under the IsBinarish conditional because it doesn't appear to be correctly implemented in the original and may not be carried over into the new refactoring

    * OneLine content test

    * fixed DeleteLine buff tests

    DeleteLine will append a null terminator, which was not accounted for previously.

    * DeleteSequentialLines exception tests

    * DeleteSequentialLines typical usage tests

    * DuplicateLine exception tests

    * Fixed testing buffer equality

    also added buffer equality test to cases that needed it

    * DuplicateLine OneLine

    * DuplicateLine TwoLines and ThreeLines

    * CopyLineCloseBy tests

    * DuplicateLineMutatorTest fixes

    - previous version assumed DuplicateLine operated like RepeatLine; this has been corrected
    - simplified buffer content tests
    - various cosmetic changes to improve readability

    * RepeatLine Tests

    * SwapLine tests

    * Merge pull request #4 from crusoe112/Radamsa-Mutator-Refactoring

    Splitting each mutator off into its own class

    ---------

    Signed-off-by: GabeClark99 <[email protected]>
    Co-authored-by: Marc Bohler <[email protected]>
    Co-authored-by: crusoe112 <[email protected]>

---------

Signed-off-by: GabeClark99 <[email protected]>
Co-authored-by: Marc Bohler <[email protected]>
Co-authored-by: crusoe112 <[email protected]>
Co-authored-by: Joshua Weader <[email protected]>
Co-authored-by: Dharsee, Komail <[email protected]>
* VMF v4.0.0 compatibility

* Add Determinism module set

AFLDeterministicFeedback: removes testcase execution time from fitness, and ignores hangs which alleviates some determinism issues
DeterministicTesterOutput: computes a running checksum of all generated testcase contents and IDs

* VMF 5.0.0 Release

* VMF 5 Fixes

Use latest VMF version
Fixes for latest VMF version
- explicit casts for VmfRand::randBetween(int, int)
- add yaml-cpp

---------

Co-authored-by: Joshua Weader <[email protected]>
Co-authored-by: Dharsee, Komail <[email protected]>
GabeClark99 and others added 2 commits June 19, 2025 10:46
minor changes to kali dockerfile
* Added AFLPlusPlus Mutators

* Fixed CMakeLists format

* Fixed CMakeLists

* Fixed CMakeLists

* Added AFL dependencies

* Fixed CMakeLists

* Added LibAFL-legacy dependency

* LibAFL-legacy dependency

* Adjusted LibAFL-legacy dependency

* LibAFL-legacy

* external dependencies

* include external

* vmf dependency

* Testing rand.h

* rand.h test

* test rand.h

* rand.h test

* Include LibAFL-legacy

* LibAFL-legacy test

* LibAFL-legacy test

* LibAFL-legacy test

* LibAFL-legacy test

* Include AFL-legacy

* Test LibAFL-legacy

* LibAFL-legacy

* Updated for modern releases

---------

Co-authored-by: mbohler <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant