Under International Law, a ship in distress can be declared "salvage" by:
1. The master signing a "Lloyd's Open Contract" with the salvager. The basis of the Lloyds contract is no fix-no pay.
2. The salvager boards the ship and its deserted.
The cargo is generally insured separately than the ship itself. The cargo remains the property of the original owner until its off loaded at the destination or the property of the insurance company once the claim is settled. I think the old comman law maxim of "finders keepers" is a little outdated.
There was a period in history when a substantial income was made by people who "found" cargo from shipwrecks and kept it. They even went to the trouble of contructing false lighthouses to keep the trade going.