-
Notifications
You must be signed in to change notification settings - Fork 32
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
Multi-line packets are forwarded by the igate, allowing command injection attacks #3
Comments
Thanks you. |
Hello, This ticket has been closed without fixing the issue? The bug needs to be fixed to make the igate work correctly. Thanks! |
@nakhonthai |
I understand the problem as Hessu said, regarding CR, LF and Binary in frames. Because the TNC and igate code are combined together, the TNC section has CRC checks in the AX.25 protocol and the APRS info data is text only, with no assci or binary. The problems mentioned I found this a lot in other igate projects. However, I will include this bug in my code. To prevent mistakes and to provide a basis for others to develop further. |
I will upload again affter open shared ESP32APRS _T-TWR Plus project. |
@nakhonthai Please reopen the bug until the bug is fixed, so that it's easier to track it? Also, so that it is clearer to everyone that the bug is still present. |
The underlying problem is that the AX.25 protocol allows any station to transmit a packet which contains many lines of data, with CR / LF sequences in them. On the other hand, the APRS protocol (not a great protocol as such) consists of one-line packets. Likewise the APRS-IS network deals with one-line packets. If an igate forwards a packet of multiple lines from RF to APRS-IS, any station on RF may inject commands to the APRS-IS server, effectively making a DOS attack, or other confusion. This may be done intentionally or accidentally, or due to packet corruption (which is quite common, actually). For example, a station may send the following two-line packet on RF:
Your igate will forward the second line, unmodified, to the APRS-IS server. The server will treat it as an individual packet or command, and will not know it is somehow attached or related to the first line, because the CR LF sequence is the delimiter between two packets, according to the APRS-IS. The APRS-IS server will start sending all packets sourced by US callsigns to your igate, which might be choked or confused by the large amount of traffic. The fix is to not send anything beyond the first CR or LF, and to always terminate with a CR LF when sending to APRS-IS. https://github.com/hessu/aprsc/blob/main/doc/IGATE-HINTS.md#packets-modified-by-igates |
https://github.com/nakhonthai/ESP32IGate/blob/b1386e0716aec2434063c5d0689d838af088dd84/src/igate.cpp#L83
APRS packets are only supposed to contain a single line of data. If a packet containing multiple lines of data (with some CR LF sequences in there), this igate now forwards all of those lines to the APRS-IS server. It generates the packet header for the first line it sends, but the additional lines will be forwarded unmodified, without header of any sort, and may contain additional headers, or anything else.
The second line in the received packet could just as well be an APRS-IS server command, such as
#filter p/N
which would suddenly cause the igate to receive a lot of packets from the APRS-IS server.From https://github.com/hessu/aprsc/blob/main/doc/IGATE-HINTS.md:
Stop sending at the first CR or LF character in the packet, and send a CR LF sequence at the end of that line.
Thanks!
The text was updated successfully, but these errors were encountered: