If it has detached from the actual handbrake assembly in the rear, then it is a matter of pulling off the road wheel, and looking at the whole issue of why it came off. Which could be a break and expensive.
However if it has just released from the cable mounting clip, and the actual cable end hasn't detached from the handbrake assembly you are in luck. Simply chock your car, jack it up and put on car stands for a more solid and stable platform.
Take of the road wheel, release the handbrake while making sure the cable end is firmly attached at the handbrake assembly, push the handbrake cable back in to the cable hook clip. Adjust and test the handbrake operation and if all is well. Good job. Otherwise.
If the ball end is missing off the cable, then a new cable will be needed.