Ask Your Question

Decoding payload as ASN.1 DER/BER

asked 2020-06-30 13:49:45 +0000

schmittlauch gravatar image

updated 2020-06-30 14:53:54 +0000

I designed a custom UDP-based protocol and serialise the payload as ASN.1 DER. While Wireshark claims to have BER (the non-canonical version of DER) dissecting support, I cannot find BER, DER or ASN.1 in the list of protocols in the "Decode as…" window.

An old mailing list post from 2011 claims that Wireshark used to be able to decode arbitrary payloads as ASN.1 BER and that, while the functionality was lost, it was trivial to re-introduce that. But it looks like the progress on that has stalled.

Am I missing the right way for decoding stuff as BER or is this really not possible anymore?

I am using Wireshark-qt Version 3.2.3 (Git commit f39b50865a13) on NixOS


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-06-30 14:20:09 +0000

Anders gravatar image

There is this code in packet-ber.c

    /* allow the dissection of BER/DER carried over a TCP transport
   by using "Decode As..." */
dissector_add_for_decode_as_with_preference("tcp.port", ber_handle);

You cound try it out by hand crafting a TCP packet with your BER as payload. If it works we could easily add UDP. The prefered metod of decoding asn1 coded protocol is to use the asn1 decription(s) and auto generate a dissector using the asn2wrs script.

edit flag offensive delete link more


@Anders I just crafted a TCP packet with my ASN.1 BER payload, and the ASN.1 dissector works totally fine on it. It'd be very useful to enable that dissector for UDP as well. While I'll probably take a look at asn2wrs at some point, the raw decoded ASN.1 already is a good statring point for investigations before taking the additional effort of asn2wrs.

How to proceed? Shall I open a bug about this? I can provide dumps of both TCP and UDP example packets.

schmittlauch gravatar imageschmittlauch ( 2020-06-30 15:28:45 +0000 )edit

pushed a patch

Anders gravatar imageAnders ( 2020-07-01 06:42:34 +0000 )edit

Great, I just compiled 3.2.3 with that patch and it's working fine. Thank you.

schmittlauch gravatar imageschmittlauch ( 2020-07-01 17:12:53 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-06-30 13:49:45 +0000

Seen: 1,719 times

Last updated: Jun 30 '20