We had the same a few years back. I think they arrived in whole grain flour that we purchased. We threw everything open away and all the cereal/pasta open or not. We now freeze all our flour when it comes in the house - which will kill any larva. Once it's been frozen for a few days I do store it in the pantry in plastic containers. No problems since.
See this also:
Bugs in Your Cupboards