Mutual masturbation (hand job, lending a hand),
Masturbation, either alone or with a partner carries virtually no risk of transmitting HIV or other STBBIs.
Still, there are two practices that do carry some small amount of risk:
Using your partner’s sperm or pre-ejaculatory fluid (pre-cum) to masturbate. It’s recommended that you use lube instead.
Masturbating by rubbing your penis against your partner’s penis can carry a risk of transmitting STBBIs.