The fact that cargo's illegal doesn't mean you can't sell it
It's not really a discussion we should have in a subforum about ships and loadouts, but all you have to do is to find a station, but preferably outpost or ground base with black market. (You should avoid being scanned, of course)
As for the legality and illegality of cargo, Elite follows quite simple rules. You didn't buy it = it's not yours. Even if it falls out from a pirate ship, there still is the owner of that container, somewhere.
Strangely enough, down on the planet surface, everything is legal. (I guess the planets have their own jurisdiction, independent on the galactic one)