Most fan fiction is published on the Internet (see fanfiction.net), and it's usually preceded by disclaimers noting that the writer is using characters or settings from someone else's work.
WSJ: The Fine Points of Fan Fiction, from 'Fifty Shades' to 'Lavinia' | Dear Book Lover