It is a junction box to allow disconnection of the wires when the mast is removed.
I would guess combination of nav lights and/or
wind instruments.
Wind instruments typically need 5-7 wires and the
navigation lights include tricolour,
steering light. Windex light,
anchor light, spreader lights etc.
There is not enough conductors for all of these options, but it will be some combination.
Radar and VHF/27MHZ aerials are also sometimes fitted on the mast, but the former requires a couple of thick conductors (as well as some thinner wires) and the later requires coax and you have already noted the aerials are not mast mounted.
What is fitted (or has been) fitted on the mast?