Hello & a belated Welcome to the Forum.
My fix for your dilemna is to use a jar or tube of petrolium jelly and cover the areas you don't want painted. When paint dries wipe off the vaseline. You might want to carefully wipe the track with alcohol to disolve any remnant vaseline.
I've used this trick after soaking track in agricultural vinegar.
Be sure to make sure your insulating paper survives.
l hope this helps....
Happy Rails
..
dave