{"record":{"id":"6de31e6e64ccb41d","repo":"peass-ng/PEASS-ng","slug":"unsupported-tag-number","errorCode":null,"errorMessage":"unsupported tag number","messagePattern":"unsupported tag number","errorType":"validation","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerApplicationSpecific.cs","lineNumber":152,"sourceCode":"\t\t * @throws IOException if reconstruction fails.\n\t\t */\n\t\tpublic Asn1Object GetObject()\n\t\t{\n\t\t\treturn FromByteArray(GetContents());\n\t\t}\n\n\t\t/**\n\t\t * Return the enclosed object assuming implicit tagging.\n\t\t *\n\t\t * @param derTagNo the type tag that should be applied to the object's contents.\n\t\t * @return  the resulting object\n\t\t * @throws IOException if reconstruction fails.\n\t\t */\n\t\tpublic Asn1Object GetObject(\n\t\t\tint derTagNo)\n\t\t{\n\t\t\tif (derTagNo >= 0x1f)\n\t\t\t\tthrow new IOException(\"unsupported tag number\");\n\n\t\t\tbyte[] orig = this.GetEncoded();\n\t\t\tbyte[] tmp = ReplaceTagNumber(derTagNo, orig);\n\n\t\t\tif ((orig[0] & Asn1Tags.Constructed) != 0)\n\t\t\t{\n\t\t\t\ttmp[0] |= Asn1Tags.Constructed;\n\t\t\t}\n\n\t\t\treturn FromByteArray(tmp);\n\t\t}\n\n\t\tinternal override void Encode(\n\t\t\tDerOutputStream derOut)\n\t\t{\n\t\t\tint classBits = Asn1Tags.Application;\n\t\t\tif (isConstructed)\n\t\t\t{","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/DerApplicationSpecific.cs#L134-L170","documentation":"DerApplicationSpecific.GetObject(int derTagNo) refuses tag numbers >= 0x1f because only low tag numbers can be represented by a single-octet tag when the tag number is rewritten; it throws IOException 'unsupported tag number'.","triggerScenarios":"Calling appSpecific.GetObject(tagNo) with tagNo >= 31 (0x1f) — e.g. passing 0x1f itself, or accidentally passing a combined tag octet (class+constructed+tag) instead of just the tag number.","commonSituations":"Extracting the inner object of an APPLICATION element with a high-tag-number; passing an already-masked byte like 0x61 ('a') as a tag instead of its low 5 bits; protocol implementations using tags > 30.","solutions":["Use a tag number below 0x1f, masking: derTagNo & 0x1f only if the value was a full tag octet","If a high tag is genuinely needed, parse the content manually: new Asn1InputStream(app.GetContents()).ReadObject()","Double-check you are not passing a class/constructed-flag byte — pass only the 5-bit tag number","Update the protocol design/constant to a supported low tag number"],"exampleFix":"// before\nAsn1Object o = app.GetObject(0x40); // >= 0x1f -> throws\n// after\nint tagNo = 0x40 & 0x1f; // or use a tag < 31\nAsn1Object o = app.GetObject(tagNo);","handlingStrategy":"validation","validationCode":"bool IsLowTagNumber(int tagNo) => tagNo >= 0 && tagNo < 0x1f;","typeGuard":null,"tryCatchPattern":"if (tagNo >= 0x1f) { // fallback: parse contents directly\n    return new Asn1InputStream(app.GetContents()).ReadObject(); }","preventionTips":["Keep protocol tag numbers below 31 for application-specific objects","Pass only the 5-bit tag number, never the full tag octet with class/constructed bits","Use Asn1InputStream over GetContents() when high tags are unavoidable"],"tags":["asn1","tag-number","argument","bouncycastle"],"backgroundTag":"unsupported-asn1-tag","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}