Fanfics are 100% copyright infringement, there's no fair use/dealings defence of them. There's just little point for corporations to go out and enforce their copyright, fanfic authors likely don't have much money and it'd be a PR nightmare. Obviously this equation changes when people start to profit of fan work, it's why AO3 doesn't allow direct links to donation pages.