State of Grace and Demonic Possession If a person has not committed a mortal sin and is living in a state of grace, is it possible for that person to be possessed by a demon?

What is the Catholic Church's teaching on demonic possession and how to prevent it?
Unfortunately a Catholic living in the state of grace and has never committed a mortal sin could be diabolically possessed by a demon(s) through no fault of their own. Sometimes a person is unaware that the possession has happened until it is too late. 

Fr. Gabriele Amorth in his book, An Exorcist Tells His Story (pages 56-63) gives the following reasons for persons becoming possessed by the devil:


  
  With God's permission.
  Being cursed by someone.
  When subject to an evil eye.
  A grave and hardened state of sin. 
  Association with evil people and places.
  


I know this does not sound fair, but a saint or someone living a saintly life could be diabolically possessed and there are examples to prove this.

St. Benedict of Nursia dealt with the enemy of mankind on several occasions as we can see in the Dialogues of St. Gregory. In Chapter 30, for example St Benedict delivered a monk from the hands of the Evil One, who wanted to disrupt the building of a monastery.



Saint Benedict Restores a Monk to Life after he's been crushed by a falling wall; by the crumbling stone, an imp hovers, waiting to cause more trouble.

Possession With God's Permission alone is extremely rare in comparison to someone being possessed by being cursed by someone. Saint Mariam of Jesus Crucified (5 January 1846 – 26 August 1878) is an excellent example of this. She was actually possessed by the devil during her lifetime. Sister Mary of Jesus Crucified was beatified by Pope John Paul II on 13 November 1983 and was canonized on 17 May 2015 by Pope Francis. 


  Little Mariam Baouardy, now known as Sister Mary of Jesus Crucified, was professed on 21 November 1871 as a Carmelite Religious. Prior to that action she was subjected to severe supernatural adversities. One of the most terrible was diabolic possession for a period of 40 days. She persevered in her simple child-like faith in God the Son and His Holy Mother Mary. Her rewards were those reserved for the most privileged of humans. She was fixed with the stigmata of her crucified Savior, experienced levitations, transverberations of the heart, knowledge of hearts, prophecies, possession by the Good Angel, and facial radiance. - "The Little Arab"




Mariam (St Mary of Jesus Crucified) 

Protecting oneself against the Devil is not magic (pardon the pun), but the Church does offer some helpful tools in our spiritual life towards union with God. 


  
  Live a holy and sacramental life going to Mass and receiving Holy Communion in the state of grace.
  Go to Confession on a regular basis (once a month). Fr. Gabriele Amorth tells us that this sacrament is the primary step to be freed from the Devil's clutch.
  Wear or carry close to your person a blessed Medal of St. Benedict.
  Wear the Miraculous Medal around one's neck. "All who wear them will receive great graces" when blessed.
  


On a personal note: I wear the Miraculous Medal everyday and carry a St. Benedict Medal in our car at all times. The Medal of St. Benedict I get blessed by the Abbot of a local monastery according to the Roman Ritual of the Extraordinary Rite because this blessing contains a minor exorcism. The ones I occasionally give away are gold plated are also blessed by a priest of the Extraordinary Rite of the Mass on the Feast of the Epiphany with the blessing for Gold, Frankincense and Myrrh (Benedictio Auru, Thuris et Myrrhae in Festo Epiphaniae) which also contain a minor exorcism within this blessing. This blessing is reserved for this feast.


  What is the difference between a major exorcism and a minor exorcism?
  
  While both forms of exorcism are directed against the power of the devil, the Rite of Major Exorcism is employed only when there is a case of genuine demonic possession, namely, when it is determined that the presence of the devil is in the body of the possessed and the devil is able to exercise dominion over that body. 
  
  Minor exorcisms are prayers used to break the influence of evil and sin in a person's life, whether as a catechumen preparing for Baptism or as one of the Baptized faithful striving to overcome the influence of evil and sin in his or her life. - Frequently Asked Questions about Exorcism