It is fairly straightforward to find all references to static assets in phpbb via regular expressions. The challenge is that image urls and such are relative, not absolute. You would have to process each level of files separately to properly convert relative to absolute urls. Then you could prepend host and path to the urls to make all urls point to the cdn of your choice.
You can use my asset timestamping script for inspiration: https://gist.github.com/1645495
(built and tested against phpbb 3.0.5 or so).
For other thoughts see this topic: http://area51.phpbb.com/phpBB/viewtopic ... 84&t=33213