Private servers are not authorised by Blizzard Entertainment, and since they run on copied or reverse-engineered server code, they occupy a legal grey area at best.
More immediately, connecting to one breaks the Terms of Use and Acceptable Use Policy you agree to every time you patch or install the client. Accounts caught doing so can be banned, so the risk falls on you rather than the server operator.