Bite you on the leg
Trolls threaten to bite you on the leg formulaically and people discuss being bit on the leg formulaically because it's better than letting other sorts of metaphors proliferate, using unfortunate words like "attack", "hurt", "get angry with", etc., none of which may apply. Since it's obvious no one can be actually bit via IP, it's obvious that this is a metaphor and not any kind of analogous "community" nonsense. Also as small animals who don't know any better and feel frightened are usually the ones biting people on the leg, the phrase helps evoke sympathy. It is somewhat evocative of sympathy for endangered species being driven out of their habitat. People often use the phrase ankle-biter for children for more or less exactly these reasons.
Also as trolls are thought to physically dwell under bridges, it would be more likely for them to crawl up only so far to bite you on the leg before slithering back underneath.