I've flown over both Iran and Afghanistan on commercial airliners. In fact, I've even flown over Iran in a US-registered aircraft (BOM-FRA on DL in 2000), and I seem to recall a NW DC-10 making an emergency landing in Teheran not too long ago. ETA:
source
I've not yet flown over Iraq, though I've heard this happens fairly often.
I know that North Korea is carefully avoided by a fair number of flights however.
One example is flights from Japan to Northern China, i.e. Tokyo to Shenyang (NRT-SHE). The shortest distance would take them across North Korea, but the flight path actually takes them across South Korea, then into China and then back to Shenyang. See this
map.