Measure the length of all four sides of the opening around the ceiling box using a tape measure. Lay the crown molding face down on a flat surface like a table or work bench. Measure the crown molding and mark it using a pencil to the length of one side of the ceiling box opening. Continue measuring and marking the crown molding for the remaining three sides of the opening.
Adjust the blade on a miter saw to 45 degrees to cut to the left. To form outside corner joints, place a piece of crown molding on the miter saw and cut the end to a 45-degree angle. Repeat the cuts for one end of each piece of crown molding. Rotate the saw to make 45-degree cuts to the right on the opposite end of each piece of crown molding.
Secure the top edge of one piece of crown molding to the joist by the corresponding side of the ceiling box. Use a nail gun and finish nails to attach it. Fit the end of the next piece of crown molding along the edge of the ceiling box and against the end of the first piece to form a 90-degree corner. Secure the crown molding to the ceiling joist using the nail gun and finish nails. Add the final two pieces of crown molding following the same procedure.
Sand the cut corners of the crown molding smooth by gently rubbing them with 100-grit sandpaper. Cut the tip off of a tube of caulk at a 45-degree angle using a utility knife. Insert the caulk into the barrel of a caulking gun. Fill any gaps on the corners and between the crown molding and the ceiling with caulk by gently squeezing the trigger of the caulking gun to emit caulk from the tube and applying it to the gaps. Smooth the caulk into the gaps by running your finger over it.
Apply woody putty or another filler to any visible nail holes in the crown molding using a craft stick or your finger. Pick up a small amount of wood putty on the end of the craft stick and press it into the nail holes. Allow the wood putty to dry completely. Gently sand the filler smooth using 100-grit sandpaper.
Pour paint in the color of your choice into a paint tray. Drip the tip of a paintbrush into the paint and apply it to the crown molding using long back and forth strokes. Paint the back side of the crown molding if it is visible when standing underneath of the ceiling box.