It may seem extremely harmless to borrow someone's data cable or charger to recharge a phone's battery but the astonishing possibility of these accessories being misused to hack into the main device cannot be ruled out completely.
Several ethical hackers and cybersecurity experts around the world have been issuing warnings against borrowing data cables or chargers from others, especially unknown people. This is because it has been found that many miscreants are now adding a special chip to USB chargers which can then be used to access devices over open WiFi networks.
The process is believed to be similar to using a pen drive to transfer data and just as a pen drive plugs into a device, the cable too acts in a similar manner with one of its ends connected to the main device while the other fitted into the charger with the malicious chip. In case the phone is locked, hacking is not possible even if it is connected to a modified charger but in case it is open - and many use their devices while these are being charged, data and important online credentials can be stolen discreetly.
What is even more shocking is that the person lending the cable and charger may not even be aware that these accessories are potential hacking devices. With markets around the world flooded with mobiles and mobile components, hackers can easily flood their tweaked products into the supply chain.
Cyber experts, therefore, recommend using the charger and data cable provided with the phone to ensure complete security.