The candid conversation was caught on camera during an event at Buckingham Palace at an event to mark the Queen's 90th birthday.
Mr Cameron was speaking to the Queen, the Archbishop of Canterbury and the House of Commons Speaker about this week's anti-corruption summit in London, when he said:
"A very successful cabinet meeting this morning, we talked about our anti-corruption summit, we've got the Nigerians.. actually we've got the leaders of some fantastically corrupt countries. No Nigeria and Afghanistan, possibly the two most corrupt countries in the world..."
After Mr Cameron's comments, Archbishop of Canterbury Justin Welby corrected him, before Speaker John Bercow made a joke.
Welby: "But this particular president is not corrupt... he's trying very hard."
Bercow: "They are coming at their own expense, one assumes?"
Nigeria's president Muhammadu Buhari came to power last year vowing to fight corruption.
He says he's shocked and embarrassed by the remarks, and suggested Mr Cameron must have been referring to his predecessor.
Cobus de Swardt is the Managing Director of Global Anti-Corruption group Transparency International.
He says while the comments are not necessarily untrue, they do not tell the whole story.
"Historically Nigeria and Afghanistan have had very high levels of corruption. That continues. At the same time, current leadership have sent very strong signals that they want to change that. And this summit in London this week is the opportunity for those countries to sign up to a new era. At the same time, countries such as the UK also have to sign up to changing their fight against corruption, as the UK and its own overseas territories remain a safe haven for corrupt money and a big problem for corruption worldwide."
The UK will host world and business leaders at the summit in London on Thursday aiming to come up with a global response to tackle corruption.