The answer is two. Malinga's hat-tricks came in the 2007 and 2011 World Cups, both against South Africa. He is one of only four bowlers to have taken two World Cup hat-tricks, along with Wasim Akram, Saqlain Mushtaq, and Rashid Khan.
Lasith Malinga Brainpower Battle: 30 Questions to prove your mental prowess