BitTorrent, magnet links, and DHT are neutral technologies. The legal risk usually comes from what content is being shared and whether the person sharing or downloading has permission.
The same protocol can be used for lawful and unlawful sharing. That is why any legal analysis has to focus on the rights attached to the file, not just on the existence of a magnet link or torrent client.