Use a shelf bracket like this in at least the 4" size. Cut down one end to 1-1/2" so that it hooks onto the bottom of the stud. Use epoxy, then 2 screws into the inside face and a screw into the bottom to clamp it until the epoxy sets. Done.
:)ensen.