I just got done with a much more serious repair on my boat. I had a crack under the rub rail. I took the whole corner off, replaced the filler with marine plywood, reinforced epoxy and re-installed the glass.
This looks like a boat that was rubbing up against the dock or pilings for a while. The rub rail screws into the fiberglass top and bottom half of the boat.There is not a lot of reinforcement behind the edge the rub rail sits on. The rubbing works the screws in the rub rail until they are loose and then work like a saw on the screw holes. I would try to get some material (reinforced epoxy or glass cloth) behind the screw holes.
I would get some West system 105 epoxy, 404 or 406 filler and 206 slow hardened. Thicken the epoxy and use a caulk gun shell (West System) to squirt into the voids and fill the rail. Maybe add a layer of glass cloth over the vertical edges to add support and reinforce the screw holes. Clean off and smooth before it hardens. These fillers are hard to sand.Then re-drill as you install rub rail.
Another option is to work with glass cloth in small epoxy batches, wet the cloth and push into the holes. Then go over with reinforced epoxy. The glass cloth will give the screws something to hold on to.