I've had a few intermittant rattling issues from the roof area over the cargo area of my 2014 2.5i Limited Forester (with the powered rear gate). But only when I had the sunroof open. Taken to the local dealer and it was found that one of the cross beams was a litte out of alignment. When the roof was wide open, the beam and the sunroof would touch, causing the rattle. The dealer added some very - VERY - thin foam tape to the underside of the beam and also added some additional silicone adhesive/filler between the beam and the inner skin of the roof. No more rattle. This was the 2nd attempt to fix. The first was just adding the silicone filler/adhesive, which dried out after a while. Also, check your license plate and/or license plate frame. Ths can cause some of the rattling. Put a bit of insulation tape (from the local hardware store) on the back-side of your licence plate at the bottom (and the top?) to help keep the plate and frame from tap-tap-tapping on the rear gate.
Also, take a look UNDER the rear floor of the cargo area - where the spare tire and such is located. Make sure none of the tools (or anything you may have stored in there) is rattling.
If all else fails, take your Forester back to the dealer and see what they can help you find.