White hat hacking (aka "ethical hacking", or "penetration testing") is the act of attacking a computer security system for the purpose of finding and fixing vulnerabilities. It is the opposite of black hat hacking.
From wikipedia:
The term "white hat" in Internet slang refers to an ethical computer hacker, or a computer security expert, who specializes in penetration testing and in other testing methodologies that ensures the security of an organization's information systems. Ethical hacking is a term meant to imply a broader category than just penetration testing.
The main differentiating factors for white hat hacking is the aim to increase the security of systems by either creating patches for or notifying vendors about the vulnerabilities they discover.
White hat hackers will restrict their testing to systems they have permission to test, such as under a bug bounty program or penetration testing contract, and they typically do not sell vulnerability information for personal profit.