What is the proper way to store an oil filter?
If short term, in the garage on a shelf is fine.
If long term, ideally indoors with minimal temperature and humidity swings.
Some would even add in a zip lock baggie with a desiccant.
In an attic that can get to 120°F and 90% humidity or below freezing and 20% humidity, it can dry out the media, or ring and/or nitrile ADV and all those parts could get very hard/brittle/deteriorated. Also could get rust on metal, and end up in the engine.
Even if stored properly, and cellulose media filter has a finite shelf life even under ideal conditions, that time is greatly shortened by bad storage conditions.
I have several filters stored in a closet in my house. temps are lowest of 64°F in winter and high of 79°F in summer, humidity between 40 and 60%.
Oldest filter is 8 years old (a Wix made Carquest Blue) and will be using it in the next month or so. Several others are 5 or so years old and will be a few more years till they are used.