Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BER decoding fails during Varbind packet extraction due to noSuchInstance on some #3900

Closed
nathanIL opened this issue Feb 14, 2023 · 2 comments · Fixed by #4069
Closed

BER decoding fails during Varbind packet extraction due to noSuchInstance on some #3900

nathanIL opened this issue Feb 14, 2023 · 2 comments · Fixed by #4069

Comments

@nathanIL
Copy link

nathanIL commented Feb 14, 2023

Brief description

Any OID that has noSuchInstance (as shown in in tcpdump) fails with:

Exception has occurred: BER_Decoding_Error
Unknown prefix [81] for [b'\x81\x00']
### Already decoded ###
None
### Remaining ###

this in turn causes the whole SNMPResponse packet to be dropped/ignored.

I'm parsing a pcap file with sniff(...), no filters, doing nothing special.

Scapy version

2.5.0

Python version

3.11

Operating system

Linux x86_64

Additional environment information

No response

How to reproduce

pick some pcap where there are noSuchIsntace responses.

Basically, run tcpdump on some device and ask/get non existing OIDs

Actual result

The whole SNMP response packet is ignored

Expected result

At least return the packet with the right / extracted varbinds and ignore the noSuchInstance ones, or create new relevant type NONE ASN1_Tag doesnt handle that.

Related resources

No response

@nathanIL nathanIL changed the title BER decoding fails during Varbind packets due to noSuchInstance BER decoding fails during Varbind packet extraction due to noSuchInstance on some Feb 14, 2023
@gpotter2
Copy link
Member

Hi, could you provide a pcap? (or something reproducible?) Thanks

@nathanIL
Copy link
Author

Hi, could you provide a pcap? (or something reproducible?) Thanks

sure, i will generate one and attach asap

gpotter2 pushed a commit that referenced this issue Jul 23, 2023
[RFC 3416](https://datatracker.ietf.org/doc/html/rfc3416#section-3)
```
   VarBind ::= SEQUENCE {
           name ObjectName,

           CHOICE {
               value          ObjectSyntax,
               unSpecified    NULL,    -- in retrieval requests

                                       -- exceptions in responses
               noSuchObject   [0] IMPLICIT NULL,
               noSuchInstance [1] IMPLICIT NULL,
               endOfMibView   [2] IMPLICIT NULL
           }
       }
```

Fixes #3900
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants