peass-ng/PEASS-ng · error · Asn1Exception

corrupted stream detected

Error message

corrupted stream detected

What it means

An integrity guard in Asn1InputStream.ReadObject: the definitive-length branch (BuildObject) detected inconsistent length/structure data — the encoded length does not match the actual content — so the stream is treated as corrupted. It fires when the byte input is truncated, damaged, or not ASN.1 at all.

Source

Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/Asn1InputStream.cs:227

                    case Asn1Tags.Sequence:
                        return new BerSequenceParser(sp).ToAsn1Object();
                    case Asn1Tags.Set:
                        return new BerSetParser(sp).ToAsn1Object();
                    case Asn1Tags.External:
                        return new DerExternalParser(sp).ToAsn1Object();
                    default:
                        throw new IOException("unknown BER object encountered");
                }
            }
            else
            {
                try
                {
                    return BuildObject(tag, tagNo, length);
                }
                catch (ArgumentException e)
                {
                    throw new Asn1Exception("corrupted stream detected", e);
                }
            }
        }

        internal virtual int Limit
        {
            get { return limit; }
        }

        internal static int ReadTagNumber(
            Stream s,
            int tag)
        {
            int tagNo = tag & 0x1f;

            //
            // with tagged object tag number is bottom 5 bits, or stored at the start of the content
            //

View on GitHub (pinned to 53fb989abc)

Solutions

  1. Check the provenance and integrity (e.g. Base64 decode, transfer encoding) of the data being parsed
  2. Ensure the full payload was read before ASN.1 parsing; buffer the complete stream
  3. Wrap parsing in IOException handling and reject the input as malformed
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/asn1/Asn1InputStream.cs:227 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02). Data as JSON: /api/errors/a526c00c4d9ce608. Report an issue: GitHub.