I'm not positive (I don't have an iPhone), but I would suspect it says on the summary page for the iPhone (in iTunes).
For example, here's a screenshot for my iPod Nano.
...Anyone with an iPhone should be able to easily confirm or deny this. As for finding out the firmware before opening the box, I don't know.