projectdiscovery/nuclei · error

batteringram must have single payload set

Error message

batteringram must have single payload set

What it means

Raised while compiling a payload generator in pkg/protocols/common/generators (generators.go:65). Batteringram semantics replay ONE payload list against every marker position simultaneously, so if the template declares attack: batteringram and len(payloads) != 1 the generator refuses to build. Multiple payload lists require pitchfork (parallel iteration) or clusterbomb (cartesian product).

Source

Thrown at pkg/protocols/common/generators/generators.go:65

	compiled, err := generator.loadPayloads(payloadsFinal, templatePath)
	if err != nil {
		return nil, err
	}
	generator.Type = attackType
	generator.payloads = compiled

	if customAttackType != "" {
		attackTypeNew, err := toAttackType(customAttackType)
		if err != nil {
			return nil, errors.Wrap(err, "could not parse custom attack-type")
		}
		generator.Type = attackTypeNew
	}
	// Validate the batteringram payload set
	if attackType == BatteringRamAttack {
		if len(payloads) != 1 {
			return nil, errors.New("batteringram must have single payload set")
		}
	}
	return generator, nil
}

type aggressionLevelToPayloads struct {
	Low    []interface{}
	Medium []interface{}
	High   []interface{}
}

// parsePayloadsWithAggression parses the payloads with the aggression level
//
// Three aggression are supported -
//   - low
//   - medium
//   - high
//

View on GitHub (pinned to 265b3a3dec)

Solutions

  1. Switch to clusterbomb when every combination of the payload sets must be tried
  2. Switch to pitchfork when the sets are parallel (row i with row i)
  3. Or merge down to exactly one payload set if batteringram is intended

Example fix

# before
attack: batteringram
payloads:
  paths: ['/admin','/backup']
  exts: ['.zip','.bak']
# after
attack: clusterbomb
payloads:
  paths: ['/admin','/backup']
  exts: ['.zip','.bak']
Defensive patterns

Strategy: validation

Validate before calling

if tmplAttack == generators.BatteringRamAttack && len(payloads) != 1 {
    return errors.New("use clusterbomb/pitchfork for multiple payload sets")
}

Try / catch

g, err := generators.NewGenerator(payloads, ..., attackType, ...)
if err != nil && strings.Contains(err.Error(), "batteringram must have single payload set") { attackType = generators.ClusterBombAttack; g, err = generators.NewGenerator(...) }

Prevention

When it happens

Trigger: A fuzz template with attack: batteringram and two payload groups (e.g. usernames and passwords); also triggered when a generator is constructed programmatically with BatteringRamAttack and a multi-entry payloads map.

Common situations: Author starts with a batteringram template and later adds a second payload set without switching the attack mode; misunderstanding that batteringram substitutes the same value in all {{payload}} positions.

Related errors


AI-assisted analysis of projectdiscovery/nuclei@265b3a3dec (2026-08-15). Data as JSON: /api/errors/6a5668e1fecd826d. Report an issue: GitHub.