peass-ng/PEASS-ng · error · ArgumentException
Unknown S-Box - possible types: "Default", "E-Test", "E-A",
Error message
Unknown S-Box - possible types: "Default", "E-Test", "E-A", "E-B", "E-C", "E-D", "D-Test", "D-A".
What it means
Gost28147Engine.GetSBox looks up the requested S-Box by uppercase name in its static sBoxes table and throws ArgumentException when the name is not one of the eight supported identifiers (Default, E-Test, E-A, E-B, E-C, E-D, D-Test, D-A).
Source
Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/engines/Gost28147Engine.cs:360
outBytes[outOff + 3] = (byte)(num >> 24);
outBytes[outOff + 2] = (byte)(num >> 16);
outBytes[outOff + 1] = (byte)(num >> 8);
outBytes[outOff] = (byte)num;
}
/**
* Return the S-Box associated with SBoxName
* @param sBoxName name of the S-Box
* @return byte array representing the S-Box
*/
public static byte[] GetSBox(
string sBoxName)
{
byte[] sBox = (byte[])sBoxes[Platform.ToUpperInvariant(sBoxName)];
if (sBox == null)
{
throw new ArgumentException("Unknown S-Box - possible types: "
+ "\"Default\", \"E-Test\", \"E-A\", \"E-B\", \"E-C\", \"E-D\", \"D-Test\", \"D-A\".");
}
return Arrays.Clone(sBox);
}
public static string GetSBoxName(byte[] sBox)
{
foreach (string name in sBoxes.Keys)
{
byte[] sb = (byte[])sBoxes[name];
if (Arrays.AreEqual(sb, sBox))
{
return name;
}
}
throw new ArgumentException("SBOX provided did not map to a known one");View on GitHub (pinned to 53fb989abc)
Solutions
- Use one of the exact names: Default, E-Test, E-A, E-B, E-C, E-D, D-Test, D-A
- Normalize the parameter-set identifier to one of the supported names before lookup
- Normalize your own input with ToUpperInvariant and trim, since lookup is case-insensitive via Platform.ToUpperInvariant but exact-match on content
Example fix
// before
byte[] sbox = Gost28147Engine.GetSBox("tc26");
// after
byte[] sbox = Gost28147Engine.GetSBox("E-A"); Defensive patterns
Strategy: validation
Validate before calling
static readonly HashSet<string> ValidSBoxes = new HashSet<string>{"Default","E-Test","E-A","E-B","E-C","E-D","D-Test","D-A"};
if (!ValidSBoxes.Contains(sBoxName)) throw new ArgumentException("Unsupported S-Box: " + sBoxName); Type guard
bool IsKnownSBoxName(string name) => name != null && new[]{"Default","E-Test","E-A","E-B","E-C","E-D","D-Test","D-A"}.Contains(name, StringComparer.OrdinalIgnoreCase); Try / catch
try { byte[] sbox = Gost28147Engine.GetSBox(name); }
catch (ArgumentException ex) { /* fall back to "Default" or surface config error */ } Prevention
- Centralize S-Box names in an enum or constants class
- Trim and normalize external config values before lookup
- Validate S-Box config at startup, not at first use
When it happens
Trigger: Calling GetSBox("E-TEST"), GetSBox("Default ") with whitespace, GetSBox("id-tc26-gost...") or any misspelled/unsupported S-Box name.
Common situations: Using RFC/TC-26 S-Box parameter set names that this older BouncyCastle port does not support; copy-pasting names with wrong case handled by caller, trailing spaces, or hyphen/underscore confusion.
Related errors
- SBOX provided did not map to a known one
- invalid S-box passed to GOST28147 init
- invalid parameter passed to Gost28147 init -
- Gost28147 engine not initialised
- Key length invalid. Key needs to be 32 byte - 256 bit!!!
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/adae9a44acda300b.
Report an issue: GitHub.