My grandson and I were hiking and came upon a black lab cross mastiff type dog. It had a collar and sniffed us and seemed okay when we stopped as it approached. The owner was a young female hiking with another female and a guy.They were in their 20's. As they approached and saw us they waved and called to the dog who returned to her and followed them as we passed. After about 25 feet of passing them the dog returned and grabbed my leg and wouldn't let go. I yelled and the girl ran up shouting at the dog, apologizing and started making excuses. I asked why it wasn't on a leash and she stated it wasn't required on the trail. I asked their names and they refused to give any information. They leashed the dog and quickly moved down the trail as I took pictures with my I-phone. Next time I will be carrying my pistol. Incident has been reported.