The Sims 3: Showtime. It is a box that Sims who are employed in the Magician career receive when they reach level 7, and which they can use to perform "Buried Alive" and "Watery Grave".
A Sim who uses the Box of Danger has a small chance of dying, and emerging as the respective ghost. However, this is just an accident and does not depend on the magician's skills.
If a Sim dies while performing the "Watery Grave" trick, their ghost will be identical to that of a Sim who has died by drowning. After patch 1.50, the ghost is dark blue.
If a Sim dies after performing the "Buried Alive" trick, their ghost will be grayish in color and partially transparent.