You should be able to see which side it attaches to the joist then the box normally has holes. Just put two long wood screw thru the holes. Most electricians use drywall screw which is thin and doesn't hole a lot of weight but cheap.
-jeffrey815(Smartiecat);
2021-10-17(#14048682@0)