Foam sounds terrible for holding bolts. If you have to fill it and have a clear hollow access, I’d consider epoxy and some wood dowels. The dowels would be to bring the cost down because you will probably need more than a gallon of epoxy and that stuff is expensive. This is my idea, please feel free to poop on it.