Enable USB restricted mode
"Enable USB restricted mode in the Passcode settings by turning off the option,” Paul Bischoff, privacy advocate at Comparitech.com, says, "USB accessories are not permitted on the lock screen. This will prevent malware from being installed on your iPhone through the USB charging port."
Don't get juice-jacked
Don’t fall victim to juice-jacking
use USB data blockers and safely charge your phone in public places.
USB outlets at train stations, airports and coffee shops are iPhone magnets; but can you be sure the outlet is not hiding a hacking device that installs malware or copies data from your phone as soon as you plug it in?
A data blocker is a simple USB dongle that sits between the USB socket and your USB charging cable, it only connects the power lanes of the USB and will block the data pins. It is cheap, low tech, yet very effective and very much recommended when traveling."