-
Notifications
You must be signed in to change notification settings - Fork 36
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
Sniffing V2GTP packets via MAC spoofing ("Biggest Challenges" in readme) #39
Comments
Just seeing the other issue now. This is related to #38 Anyways I would be very happy on suggesstions to build something like a diode for the HF signal to physically block signals from the sniffing modem, but not block incoming traffic. |
Hi, thanks for continuing the investigations. I also tried mac flooding without success, so we have the same result. |
BTW Which type of modem did you use? |
sorry for the closing. I misclicked. Feel free to re-open (I dont have permissions). We have an EVchargeSE which can do PWM/resistor communication behaving as either car or evse, but comes with a crappy old embedded linux soc and we have two red beet eval boards (one evse, one pev). I used the redbeet for the tests. it even comes with simple dip switches for disconnecting RX/TX (mainly used for switching between PLC on AC and PLC on PWM). We tried disconnecting TX yesterday, but the communication was still the same. I assume this is because of the plc communication behaving like an antenna transmitting the signal "through" the disconnected/OFF DIP switches. The brokenwire stuff is also somewhat based on this. Maybe grounding the TX pin works. We will try this next week (Working on this as part of my employment at Technische Hochschule Ingolstadt) |
Yes, a DIP switch seems to have sufficient coupling in off state. The solution would be to cut as close as possible near the modem chip, or even shortening the tx+ and tx- directly on the chip. |
I did some further testing but the wireless transmission made it hard to get it working reliably. I am starting to think the modems exchange some form of message delivery information with each other. For some reason I sometimes get a "GetBridgeInformationsConfirmation" homeplug AV packet. You are welcome to drop by for a coffee and/or lab session any time. Maybe together we can get this to work. I assume you are working during the day, so we would have to move this to the evening? |
I tested the scenarios "spoofing PEV MAC" and "cutting the TX path". Details collected here: https://github.com/uhi22/pyPLC/blob/master/doc/sniffing_experiments.md
Maybe studying the homeplugAV specification gives some hints. Not sure whether this is public. [Edit] Using google with "homeplug_av11_specification_final_public.pdf", we find a >600pages document with a lots of details... [Edit2] The fact, that joining the network does not work, if we cut the transmit path, is explained in chapter 7.3.1: To join (participate in) an AVLN, a STA must have:
[Edit3] The feature, that the traffic is selectively transferred between the RF port and the ethernet they call it "convergence layer", and this means: "The Convergence layer performs bridging, classification of traffic into Connections, and data delivery smoothing functions.... The receive side performs the corresponding functions, in reverse." And this convergence layer contains "Classifier Rules", which decide about the routing of the traffic, based on MAC addresses and even IPv6 addresses. Crazy stuff. [Edit4] So the goal is easy to define: Just replace the Classifier Rules in a way, that incoming IPv6 traffic on the RF port is always routed to the Ethernet port. The questions to be clarified: Where are the classifier rules stored? Are they configurable in the PIB? [Edit5] Maybe APCM_CONN_ADD.REQ is our friend. It allows configuring the classifier. |
I do not think we need to manually craft a homeplug packet in this case: The int6krule tool included in open-plc-utils seems to be a cli tool to configure these classifier rules. Maybe we can use Drop and/or TagTX for preventing the other modems from receiving the packets and thus not breaking communication when doing MAC spoofing. |
Maybe the -r to read the rules gives a hint. From how I understand the rules now, I would assume our listener device automatically creates a rule "dropRX everything which has destination A or destination B". If such rules exist, the task is just to remove this rule, so that the messages are not dropped anymore. |
Added some Investigation results regarding classifier rules here: https://github.com/uhi22/pyPLC/blob/master/doc/sniffing_experiments.md#q-does-the-sniffer-modem-contain-automatic-rules-to-filter-out-the-not-wanted-traffic |
Heureka 🎉 Got this working with this script. You can find the PCAP logs here I let the two do SLAC, then as soon as I receive the SLAC_MATCH_CNF I configure a filter on the EVSE to drop all packets which are not sent by me. In theory this would also be possible without the DropRX filter, but then it relies on transmission speed and might still cause problems. Thanks to the DropRX filter we can make sure there is no communication possible between PEV and EVSE. In the future someone (@eder-lukas 👀) could/will integrate this with the automatic AVLN joining, such that upon receival of a SLAC_MATCH_CNF:
EDIT: since we can configure the filters of any PEV and EVSE, I am wondering if we could brick them by setting a permanent filter (rather than a temporary one). |
Sounds like permanent rules could be used to prevent a car charging on a certain charger, or vice versa. Ooops. |
I would assume a generic drop all rule could also prevent a car from charging at any charger, but sadly Tesla does not award bug bounties for denial of service :( I did not try setting values without joining an AVLN. For our custom charging station we always use the same NID/NMK and thus joining the AVLN once is enough for all tests. I have seen some commercial ones do this as well (superchargers if I recall correctly). Others might change their NID/NMK for each charging session though. I would not be sure if a permanent rule is even needed. From my understanding the rule is stored in pib SDRAM, which should survive the next charging session as long as the modem is not powered off completly. |
Finding out the MAC addresses of the modems is easy. We send a broadcast "get software version", and get from each modem in the AVLN a response. Ok, then still the task is to find out, which of the three modems belongs to which participant. Line 178 in 4914b2f
PCAP: https://github.com/uhi22/pyPLC/blob/master/results/2022-10-26_WP4_networkEstablishedButHiddenCommunication.pcapng |
@eder-lukas and I did a visit to the supercharger today. At first we tried adapting the PEV side PLC filter rules to tag broadcasts and catch them in our sniffer. We managed to get VLAN tagging working correctly (have to supply the 4-byte full 802.1q header), but the modem seems to still handle VLANs incorrectly: It drops the last 4 byte of the packet keeping the packet at the same size as before (but with 4 byte 802.1q header inserted in the middle). While we can reconstruct the missing 4 byte of SDP packets we cannot really reconstruct the missing 4 byte for Tesla proprietary broadcasts. Instead we configured the supercharger modem to drop packets from our tesla only (and deleted that rule later before leaving). This way we successfully managed to sniff tesla<->supercharger communication. The pcap file can be found here. To me it looks like the broadcasts are missing at the start, but it also does not make sense how this should work without the broadcasts. Making sense of the proprietary protocol will probably be @eder-lukas master thesis topic. Anyways for now I think we can close this issue? We did not really solve the sniffing problem, but SDP based MITM is good enough for most use cases. |
Great progress. And because everything good needs a name, I would call this approach the "Ingolstadt CCS Leak" or "Ingolstadt Leak" :-) |
Hey,
we have been partially successfull in convincing the modem to forward packets which were ment for the car to us.
The trick was to send a fake packet which looks like its originating from the car to some random/broadcast address.
This makes the modem think the device with the cars mac address is in fact connected to its ethernet port and thus forwards packets ment for the car to its ethernet side.
Sadly this approach seems to also affect the cars modem and thus it does not forward packets ment for the car to the cars secc anymore i.e. breaking charging communication / causing a lot of retransmissions.
One solution could be to somehow (physically) prevent the modem from actually sending something, but allowing to receive. Somewhat like a diode, but a classical diode probably does not work with the HF powerline signal.
We did some tests with different PIB options to prevent it from sending (i.e. changing the TxGain), but either we did something wrong, or none of them seem to have any effect. I also tried flooding the MAC cache but also without any luck.
Let me know if you have any idea on how to make this work.
You can find our script for spoofing the routing here. And for flooding the cache here
The text was updated successfully, but these errors were encountered: