or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/atheris@2.3.x
tile.json

tessl/pypi-atheris

tessl install tessl/pypi-atheris@2.3.0

A coverage-guided fuzzer for Python and Python extensions based on libFuzzer

Agent Success

Agent success rate when using this tile

91%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.28x

Baseline

Agent success rate without this tile

71%

task.mdevals/scenario-9/

Custom Module Loader Fuzzing

Create a fuzzing harness that tests Python code loaded through a custom import mechanism. Your implementation should handle modules that are loaded from non-standard sources (such as in-memory modules or custom loaders) and ensure they are properly instrumented for fuzzing.

Requirements

Your solution should:

  1. Create a custom module loader that loads Python code from an in-memory source (not from the filesystem)
  2. Use fuzzing instrumentation that works with this custom loader
  3. Implement a fuzzing harness that:
    • Accepts byte input from the fuzzer
    • Uses the custom loader to import a test module
    • Calls a function from the imported module with fuzzer-generated data
    • Handles any exceptions that may occur during fuzzing

The test module (loaded by your custom loader) should contain a simple function that processes string input and has a deliberate vulnerability that the fuzzer can discover (e.g., crashes on specific input patterns).

Test Cases

  • The custom loader successfully loads a module from memory and makes it importable @test
  • The fuzzing harness runs without errors when provided with valid input data @test
  • Modules loaded through the custom loader are properly instrumented for fuzzing @test

Implementation

@generates

API

def TestOneInput(data: bytes) -> int:
    """
    Fuzzing entry point that receives random byte input.

    Args:
        data: Random bytes from the fuzzer

    Returns:
        0 to continue fuzzing, -1 to stop
    """
    pass

class InMemoryLoader:
    """
    Custom loader that loads Python modules from in-memory source code.
    """
    def __init__(self, module_name: str, source_code: str):
        """
        Initialize the loader with module name and source code.

        Args:
            module_name: Name of the module to create
            source_code: Python source code as a string
        """
        pass

    def load_module(self):
        """
        Load the module and make it available for import.

        Returns:
            The loaded module object
        """
        pass

def setup_fuzzer():
    """
    Initialize the fuzzing environment with custom loader support.
    """
    pass

Dependencies { .dependencies }

atheris { .dependency }

Provides Python fuzzing capabilities with support for custom import mechanisms.

@satisfied-by