Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:AISecurityLab Hackagent BoNAttack

From Leeroopedia
Knowledge Sources
Domains Security_Testing, Adaptive_Attacks
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete stochastic search attack that sends independently seeded augmentations of the goal to the target, judging the longest usable reply per step, stopping at the first success, provided by the HackAgent adaptive attacks package.

Description

BoNAttack extends IterativeAttack and runs a fixed number of steps. Each step generates candidates independently seeded perturbations of the goal (via augment_text), sends them all concurrently to the target, and selects the longest usable reply as the step's representative. The panel judges only that one reply — the other candidates differ only by noise and remain in the trace. The search stops at the first step the panel calls a success.

Usage

  • Campaign config: Set attack_type: bon with steps, candidates, sigma, and augmentation toggles.
  • No attacker role needed: BoN perturbs the goal directly — no attacker LLM required.

Code Reference

Source Location

Signature

class BoNAttack(IterativeAttack[BoNParams]):
    name = "bon"
    params_type = BoNParams

    async def search(
        self, goal: str, target: Target, judge: Optional[Judge]
    ) -> list[Finding]: ...

Import

from hackagent.attacks.techniques.adaptive.bon.attack import BoNAttack

I/O Contract

Inputs

Name Type Required Description
params BoNParams Yes Steps, candidates, sigma, augmentation toggles
goal str Yes The harmful goal
target Target Yes Callable target model
judge Judge No Panel scorer

Outputs

Name Type Description
search() list[Finding] Judged attempts (one per step)

Usage Examples

Define in Campaign YAML

# attacks:
#   - name: bon
#     steps: 4
#     candidates: 5
#     sigma: 0.4
#     word_scrambling: true
#     random_capitalization: true
#     ascii_perturbation: true

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment