White hat, black hat, and gray hat hackers. What is the difference?

There are three different types of hackers: white hat, black hat, and gray hat. A white hat hacker is a penetration tester or vulnerability researcher that aims to (legally and legitimately) improve system and network security by exposing threats and vulnerabilities. A black hat hacker maliciously exploits computer or network vulnerabilities either for personal gain or to inflict damage on a person or organization. A grey hat hacker performs activities that are clearly neither legal (white hat) nor illegal (black hat).