Taking SCARY out of used bikes, one bike at a time.
This is not a common issue but does happen.
In order to get to the freehub you need to remove the cassette and take the axle out. For removing the axle you just need to loosen and remove one side of axle nut and cone.
Once removed, there is most of the time a large allen bolt. 11mm or 12mm. It will be dependent on the hub brand. Here you can tighten or replace if need be.
Keep in mind you will need to repack the bearings and adjust cone so the hub is smooth and not loose. Then the cassette can be reinstalled.