All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad
is His Slave and Messenger.
It is not permissible to sell such boxes whose contents are unknown, even if they were given to you free of charge. This is because the validity and permissibility of a sale require that the contents of the item being sold must be known at the time of the transaction. Ignorance regarding the item constitutes excessive uncertainty, which is prohibited in Islamic law. It has been reported in a hadith that the Prophet ﷺ forbade sales involving excessive uncertainty.
Your intention to sell the box itself rather than its contents does not change the ruling, because in reality what is intended by the purchaser is the contents, not merely the empty box.
As for accepting such boxes free of charge, without any payment in return, there is no harm in doing so, even if their contents are unknown.
Allah Knows best.