Now how does the Stream-entrant attain these four factors: confirmed confidence in the Buddha, Dhamma and Saṅgha, and virtue? Let’s expand the context of the quote given at the beginning:
“[A well-taught noble disciple] sees those states of feeling, perception, fabrications and consciousness as impermanent, as suffering, as a disease, as a tumor, as a barb, as a calamity, as an affliction, as alien, as disintegrating, as void, as not-self. He turns his mind away from those states and directs it towards the deathless element thus: ‘This is peaceful, this is sublime, the stilling of all fabrications, the relinquishment of all acquisitions, the destruction of craving; dispassion, cessation, Nibbāna.’
“If he is steady in that, he attains destruction of the taints. But if he does not attain destruction of the taints because of that desire for the Dhamma, that delight in the Dhamma, then with the destruction of the five lower fetters he becomes qualified to reappear spontaneously in the Pure Abodes, and there attain final Nibbāna without ever returning from that world. This is the Path…”
— Mahā-mālunkya Sutta (MN 64)
And what are the three taints?
“Bhikkhus, there are these three taints. What three? The taint of sensuality, the taint of existence, the taint of ignorance. These are the three taints. The four establishments of mindfulness are to be developed for the full understanding of these three taints.
“What four? Here, bhikkhus, a bhikkhu dwells contemplating the body as the body … feelings as feelings … mind as mind … phenomena as phenomena—ardent, clearly comprehending, mindful, having removed covetousness and displeasure in regard to the world.”
— Āsava Sutta (SN 47.50)