Part of the description of the Ghost's possession ability says:
[The ghost] retains its Alignment, Intelligence, Wisdom, Charisma, and immunity to being charmed and frightened. It otherwise uses the possessed target's statistics, but doesn't gain access to the target's knowledge, class features, or proficiencies.
Since it does not gain the target's proficiencies, it may not be proficient with the weapon the target wields.
(The description of the ghost does not specify whether or not it has any weapon proficiencies. RAW I would rule that it has no weapon proficiencies, but as a DM I would probably rule that this would depend on what the creature's proficiencies were in life.)
If the ghost is not proficient with the weapon, I assume it can still use it using the creature's relevant attribute (strength or dex) but without adding their proficiency bonus.
Now, what if the weapon is a magic weapon that is attuned to the possessed creature?
DMG p. 136 on attunement:
Some magic items require a creature to form a bond with them before their magical properties can be used.
Can the ghost use the attuned body it is possessing to use the weapon? If not, what happens if it tries? For example, let's imagine that a PC is wielding an attuned sunblade, and has already caused the the blade to spring into existence when the ghost possesses his body. What happens if the ghost tries to attack using that weapon?
I think it's clear that the ghost can't bring the blade into existence, or dismiss it, or change the radius of its light. But can it swing it like any other sword? And if so, does it get the sword's +2 to hit? (I think not, that is a magical property of the sword.) And what kind of damage does the sword do? (The fact that it does radiant damage is also a magical property of the sword, but I can't imagine it doing any other kind of damage.)
So does the sword just turn into a flashlight in the hands of the possessed creature, or does it function as a sword to some degree?