Premeditated data breaches like this are covered under the boilerplate language in your employment contract -- "sharing data with our partners" and other such nonsense.
The salary number itself yes, but it's only useful when linked to the identity of the employee. And in places with sane privacy laws that's illegal to do without the employee's consent.