A staircase banister that is loose and moving while you hold onto it is not a safe banister. If you are a do-it-yourselfer you probably want to be able to fix that yourself.
First, the anatomy of a staircase should be clear. Its basic parts are the tread that you step on, the riser, which is the vertical part between treads, and the banister, the part that is on the side offering support when going up and down. The banister has three components: the handrail, which you actually grasp when using the stairs, the balusters, posts that support the handrail, and a newel post, a larger vertical support at the bottom of the staircase.
A handrail will usually shake if the balusters loosen in the mortises where they meet the handrail. A mortise is a hole cut into a piece of material in which another piece, the tenon, will be inserted. For the first solution you should prepare: a hammer, wood shims, carpenter’s glue, a small block of wood and an utility knife. You will coat a shim in glue and hammer it into the joint between the handrail and the baluster. Use the small wood block to drive the shim in, keeping it between the shim and the hammer. Your purpose is to fill the gap and not to drive the pieces that join apart, so hammer with care. Trim the part of the shim that is left outside of the hole.
A second solution asks for: safety goggles, electric drill, screwdriver matching the screw head, combination bit corresponding to the used screw, flathead wood screws, 220 grit sandpaper, wood putty and wood finish or paint. Drill a pilot hole upwards through the baluster and into the handrail using the combination bit. You will drill under a 45 degree angle. Drive the screw in, countersink it and tighten it. Fill the hole that is left with wood putty, allow it to dry and then sand the repair spot and cover it with wood finish or paint for the aesthetics part.
If the baluster got loose in its bottom mortise where it meets the tread, you will need the same tools and expendables like in the second solution. You will drill a pilot hole down through the baluster into the tread at an angle. Drive in the screw, countersink it and tighten it. Just like in the previous case, you will then fill the hole with wood putty, let it dry, use the sandpaper to sand the area and then finish.