There are currently two ways of testing malicious cables. Pre-made testers and standard USB Testers that you can observe the current draw.
If you don’t know what I mean, check out the O.MG Cable, I will not go into the details of how you can visually tell them apart from other cables, and it depends on the cable brands and I guess both methods are evolving fast.
If you’re serious about making sure it’s malicious, I would recommend getting both or one that includes a current meter. If you’re like me and just want to double check a cable, a USB tester that shows current is enough.
Testers:
How to Detect Malicious USB Spy Cables #TSCM #MurrayAssociatesTSCM – YouTube
https://www.youtube.com/watch?v=nKnZd_1OdsE
O.MG Malicious Cable Detector – Lab401
https://lab401.com/products/o-mg-malicious-cable-detector
The CuVoodoo USB Bug Detector Safely Ferrets Out Those Sneaky Malicious O.MG Cables – Hackster.io
https://www.hackster.io/news/the-cuvoodoo-usb-bug-detector-safely-ferrets-out-those-sneaky-malicious-o-mg-cables-b7f5d961cb5f
USB Testers
FNIRSI-FNB58 Multi-function USB Voltage/Current Meter Type-C Fast Charge Tester
Visually:
How to spot the difference between the O.MG Cable and a standard USB-A Cable – iFixit Repair Guide
https://www.ifixit.com/Guide/How+to+spot+the+difference+between+the+O.MG+Cable+and+a+standard+USB-A+Cable/155496
Other
USB Data Blocker Teardown
https://mg.lol/blog/data-blocker-teardown/