IT’S NOT CARDBOARD it’s 1/2″ drywall and it most likely is mostly fire proof baring the electrical connection. what it’s function is, is open to speculation for sure
my guess is it’s for attic ventilation, a roof-wind turbine would work way more efficiently
And that looks like wadded-up fiberglas, not foam. Probably he just scavenged some from the attic insulation to block the blow-by. It’s not dangerous,
but it’s ugly. Really ugly. Looks like a 2 AM six beer job.