Internally Pulled-Up signal on STM32 interrupt pin?
I've noticed pa11 and 12 have slightly odd characteristics, which i think is due to them being usb pins and needing to be 5v tolerant. I'm not sure about this. I don't think they have the same esd arrangement.

Pull ups are 40kohm, so try attaching 40kohm pull down and see what it does.

Otherwise, the only other time I've seen this is after I've accidentally connected a pin to too many volts...

Also worth considering... Why are you using those pins? There are other pins with dedicated encoder inputs with timers attached e.g pb4 and 5 have timer 3 which can be set in encoder mode.