{"record":{"id":"3f03305e868d166b","repo":"peass-ng/PEASS-ng","slug":"invalid-parameters-passed-to-gcm","errorCode":null,"errorMessage":"invalid parameters passed to GCM","messagePattern":"invalid parameters passed to GCM","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/modes/GcmBlockCipher.cs","lineNumber":123,"sourceCode":"                {\n                    throw new ArgumentException(\"Invalid value for MAC size: \" + macSizeBits);\n                }\n\n                macSize = macSizeBits / 8;\n                keyParam = param.Key;\n            }\n            else if (parameters is ParametersWithIV)\n            {\n                ParametersWithIV param = (ParametersWithIV)parameters;\n\n                newNonce = param.GetIV();\n                initialAssociatedText = null;\n                macSize = 16;\n                keyParam = (KeyParameter)param.Parameters;\n            }\n            else\n            {\n                throw new ArgumentException(\"invalid parameters passed to GCM\");\n            }\n\n            int bufLength = forEncryption ? BlockSize : (BlockSize + macSize);\n            this.bufBlock = new byte[bufLength];\n\n            if (newNonce == null || newNonce.Length < 1)\n            {\n                throw new ArgumentException(\"IV must be at least 1 byte\");\n            }\n\n            if (forEncryption)\n            {\n                if (nonce != null && Arrays.AreEqual(nonce, newNonce))\n                {\n                    if (keyParam == null)\n                    {\n                        throw new ArgumentException(\"cannot reuse nonce for GCM encryption\");\n                    }","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/modes/GcmBlockCipher.cs#L105-L141","documentation":"A fallback branch in GcmBlockCipher.Init: the supplied cipher parameters object was neither AeadParameters nor ParametersWithIV, so the cipher cannot obtain a nonce or key. It fires when callers pass e.g. a raw KeyParameter instead of wrapping it in ParametersWithIV/AeadParameters.","triggerScenarios":"Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/modes/GcmBlockCipher.cs:123 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wrap the key: new ParametersWithIV(keyParameter, iv) or new AeadParameters(keyParameter, macSize, iv)","Ensure the IV is generated/passed at Init time (GCM is stateful and requires a fresh nonce per encryption)","Check for accidentally passing null or a KeyParameter directly to Init"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}