{"record":{"id":"b2008b31021d24bf","repo":"peass-ng/PEASS-ng","slug":"boolean-value-should-have-1-byte-in-it","errorCode":null,"errorMessage":"BOOLEAN value should have 1 byte in it","messagePattern":"BOOLEAN value should have 1 byte in it","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerBoolean.cs","lineNumber":115,"sourceCode":"\n            return IsTrue == other.IsTrue;\n        }\n\n        protected override int Asn1GetHashCode()\n        {\n            return IsTrue.GetHashCode();\n        }\n\n        public override string ToString()\n        {\n            return IsTrue ? \"TRUE\" : \"FALSE\";\n        }\n\n        internal static DerBoolean FromOctetString(byte[] value)\n        {\n            if (value.Length != 1)\n            {\n                throw new ArgumentException(\"BOOLEAN value should have 1 byte in it\", \"value\");\n            }\n\n            byte b = value[0];\n\n            return b == 0 ? False : b == 0xFF ? True : new DerBoolean(value);\n        }\n    }\n}\n","sourceCodeStart":97,"sourceCodeEnd":124,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerBoolean.cs#L97-L124","documentation":"FromOctetString is the internal path used when unwrapping an Asn1OctetString into a DerBoolean (e.g. from tagged/encoded content). ASN.1 BOOLEAN content must be exactly one octet, so a value array of another length throws this ArgumentException before any byte is read.","triggerScenarios":"GetInstance on a tagged/encoded object whose underlying octets are longer or shorter than 1 byte; parsing a BER/DER BOOLEAN record whose content-length octet is not 0x01.","commonSituations":"Decoding certificates or protocol messages produced by a non-conformant encoder; truncated or corrupted DER streams; mislabeled fields where an OCTET STRING of arbitrary size is fed where a BOOLEAN is expected.","solutions":["Check value.Length == 1 before conversion and treat other lengths as a parse error","Fix the producing encoder so BOOLEAN is encoded as a single 0x00/0xFF octet","Re-verify offsets: you may be reading the wrong TLV so extra bytes leak into the value","Catch ArgumentException and skip/fail the record gracefully"],"exampleFix":"// before\nvar b = DerBoolean.FromOctetString(octets);\n// after\nvar b = octets.Length == 1 ? DerBoolean.FromOctetString(octets) : null;\nif (b == null) { /* malformed BOOLEAN */ }","handlingStrategy":"validation","validationCode":"if (value == null || value.Length != 1) throw new FormatException(\"BOOLEAN octets must be length 1\");","typeGuard":"bool IsSingleByte(byte[] v) => v != null && v.Length == 1;","tryCatchPattern":"try { var b = DerBoolean.FromOctetString(value); }\ncatch (ArgumentException) { /* mark element invalid and continue/skip */ }","preventionTips":["Verify content-length == 1 when decoding BOOLEAN TLVs","Fix producers to encode 0x00/0xFF single octet","Use strict DER parsing on untrusted input","Unit-test decoder against truncated/corrupt inputs"],"tags":["asn1","bouncycastle","der","parsing"],"backgroundTag":"asn1-boolean-invalid-length","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}