Oral sex is usually not as much of a risk unless the guy cums in your mouth basically. Mere touching of the penis with the outside of the anus can be a risk for some STD's but not really HIV unless body fluids connect etc. .
How old was the other guy. Did you do oral sex too ?
If he had an std and he rubbed his penis there for more than a few minutes, then yes, you could potentially get any std he may have.