Burning oil smell

what could be causing a terrible odor when the fan is used to heat or cool my 1998 subaru legacy wagon? note: this occurs only when the outside air vent is open.

An oil leak under the hood causing an oil burning smell to get into the vent system through the cowl vent. The cowl under the windshield is where the inside vent system gets it’s air from the outside.

i had this problem checked out by the dealer and an independent, reliable shop, and no one could figure out what was happening. i recently became worried that it could be serious, when i researched the problem and read about gasket issues. the car has 107k miles.