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

Failure on missing protocol version #4

Open
aaronchar opened this issue Nov 17, 2020 · 13 comments
Open

Failure on missing protocol version #4

aaronchar opened this issue Nov 17, 2020 · 13 comments

Comments

@aaronchar
Copy link

It looks like if no protocol version is defined this function will fail to correctly process the rest of the bytes

go-tcap/dialogue-pdu.go

Lines 438 to 445 in 08bd257

func (d *DialoguePDU) parseAAREFromBytes(b []byte) error {
var err error
var offset = 2
d.ProtocolVersion, err = ParseIE(b[offset:])
if err != nil {
return err
}
offset += d.ProtocolVersion.MarshalLen()

@wmnsk
Copy link
Owner

wmnsk commented Nov 18, 2020

I’m not sure that field is mandatory or optional, as it’s been so long since I worked on that implementation. Could you show the document to refer for that?

@aaronchar
Copy link
Author

aaronchar commented Nov 18, 2020

@wmnsk
I will try and find some time to dig through the spec, I was just basing this off a bunch of pcap's I was playing with trying to see how stable this was for parsing bytes off the wire.

Thanks

@wmnsk
Copy link
Owner

wmnsk commented Nov 19, 2020

OK I’ll check but give me some time to find it.

@aaronchar
Copy link
Author

No problem, I haven't had time to even pull up the spec files.

If you let me know which ones you used to write this I don't mind poking around as it seems like there might be something similar going on in ParseDialogue because i am seeing panic: runtime error: slice bounds out of range [143:109] after successfully decoding the ObjectIdentifier on a dialogueRequest

@wmnsk
Copy link
Owner

wmnsk commented Nov 29, 2020

The documents I refer are ITU-T's Q.771 - Q.775. I think it's described in Q.773, which defines the format of messages.
By the way, I saw some samples that have no Protocol Version field. So, I'll fix the codes to check the presence of fields and accepts them even if some are absent, as I make it as kind to real-world users as possible.

@aaronchar
Copy link
Author

aaronchar commented Nov 29, 2020 via email

@wmnsk
Copy link
Owner

wmnsk commented Nov 30, 2020

I might have misunderstood your case... I did not see any packets without Protocol Version, and I can't make it work without it easily. It'd be very helpful if you could provide the exact PCAP that caused the issue. Could you help with that?

@aaronchar
Copy link
Author

@wmnsk

I will see what i can do to grab a clean one , But here are a couple screen shots of a pcap i have open right now.

Screenshot from 2020-11-30 11-11-10

continue

@wmnsk
Copy link
Owner

wmnsk commented Dec 2, 2020

The problem with decoding Continue with ParseBER might have been fixed in the latest code. Could you give it a try? For the protocol version, give me some more time for investigation.
It seems you have PCAPs with confidential information. I think copying the payload as a hex dump and masking fields with dummy values (like 11, ff, etc.) and pasting it here works. Make sure not to change the length of any value in that case.

@aaronchar
Copy link
Author

aaronchar commented Dec 2, 2020

@wmnsk I just tried the latest version and it seems like it still fails to parse it correctly

([]*tcap.TCAP) (len=5 cap=5) {
 (*tcap.TCAP)(0xc0004941e0)({Transaction: {Type: 0x65, Length: 129, OrigTransactionID: <nil>, DestTransactionID: <nil>, PAbortCause: <nil>, Payload: }, Dialogue: <nil>, Components: <nil>}),
 (*tcap.TCAP)(0xc000494200)({Transaction: {Type: 0x64, Length: 0, OrigTransactionID: <nil>, DestTransactionID: <nil>, PAbortCause: <nil>, Payload: }, Dialogue: <nil>, Components: <nil>}),
 (*tcap.TCAP)(0xc000494220)({Transaction: {Type: 0x83, Length: 2, OrigTransactionID: <nil>, DestTransactionID: <nil>, PAbortCause: <nil>, Payload: }, Dialogue: <nil>, Components: <nil>}),
 (*tcap.TCAP)(0xc000494240)({Transaction: {Type: 0x30, Length: 49, OrigTransactionID: <nil>, DestTransactionID: <nil>, PAbortCause: <nil>, Payload: }, Dialogue: <nil>, Components: <nil>}),
 (*tcap.TCAP)(0xc000494260)({Transaction: {Type: 0x98, Length: 1, OrigTransactionID: <nil>, DestTransactionID: <nil>, PAbortCause: <nil>, Payload: }, Dialogue: <nil>, Components: <nil>})
}

continue_oid

as for the pcap you are on the money about private info, I was thinking about a hex dump with a mask. I will find time today or tomorrow morning to do that. Sorry it's taking me a bit

@aaronchar
Copy link
Author

aaronchar commented Dec 3, 2020

@wmnsk

This should work for a hex dump, most things should be setup with dummy values where they matter (except the sizes). This is the tcap portion of the packet so it should just be able to get pushed through parseBER.

Just let me know when you grab it so i can wipe it. Thanks

@aaronchar
Copy link
Author

@wmnsk I'm guessing I pulled it off there before you grabbed it, I'll out it back today. I just didn't like the idea of leaving it up even if it did have altered hex values .

@wmnsk
Copy link
Owner

wmnsk commented Dec 21, 2020

I think I can find it in my email box, but unfortunately I don’t have time to work on this project these days. Give me some more time.

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

No branches or pull requests

2 participants