According to a sample chapter from the Winds of Winter, most ravens can only fly to one place, although there are rare exceptions:
"A maester's raven flies to one place, and one place only. Is that correct?"
The maester mopped sweat from his brow with his sleeve. "N-not entirely, Your Grace. Most, yes. Some few can be taught to fly between two castles. Such birds are greatly prized. And once in a very great while, we find a raven who can learn the names of three or four or five castles, and fly to each upon command. Birds as clever as that come along only once in a hundred years."
Other than those rare birds, presumably once a raven is back at its home castle it would then have to be transported to a new location in a cage in order for it to be of any practical use. The clearest example of this is, as Zoe mentioned, when the Night's Watch took a cart of ravens with them on the Great Ranging. There may be other examples as well.
Regarding a "man-in-the-middle" attack. To prevent such an attack you would either have to cipher your messages using a code only the intended recipient knows how to decode, or you would have to know/trust the person(s) bringing you the ravens.
Neither contingency is discussed in the books, although in chapter 6 of GOT Catelyn mentions that a letter sent by Lysa was written using a secret language only the two of them shared. And it is not unreasonable that the people bringing/receiving ravens would expect to know each other.
In "our" universe (IE outside of the books), RFC 1149 briefly discusses security considerations for secure transmission of data via avian carriers:
Security is not generally a problem in normal operation, but special measures must be taken (such as data encryption) when avian carriers are used in a tactical environment.