USB was developed without taking into account the security of users. Windows, Linux and macOS trust any connected USB port. If the hacker has physical access to your computer, in this case the attack vector using USB becomes very dangerous.
A group of researchers from the University of Ben-Gurion decided to analyze how many ways of abusing USB. 29 ways were determined by which attackers could use USB-devices to compromise users’ computers. These methods have been classified in four different categories, depending on how the attack is conducted in the course of work.
You can find more information in Catalin Cimpanu’s article.