So I think, the good news is the jails should be able to hold up (although I need to look into that root access and /bin/sh that
@jgreco mentioned)
You may not be able to do much about that. The intent in FreeNAS is to use jail capability to provide access to a more-standard UNIX environment, and most of the jails seem to be designed that way. Plus, since volunteers make most of the jails, and most of them depend on existing ports/packages to build the jails, there's a huge dependency on full system functionality within the jail.
In the service provider world, though, what we're always worried about is the attack surface of a service. If you have to expose a ${thing} to the Internet, in order to allow people to access it, you become much more vulnerable to the possibility that someone will find your ${thing} and if there's a security vulnerability, will exploit it. These days the bad guys are making databases of ${thing}s including both
full devices but also versions of often-vulnerable or high-stakes software like PHP or SSH. So when there's suddenly a new vulnerability affecting a given bit of software, these guys literally just pull scan results out of an existing database and your server is pwned shortly thereafter.
So, if we assume that this is something that WILL happen, the next step is mitigation. UNIX, as with many operating systems, is written in C, because C is a pseudo-high-level language that is also easily translated into assembly language, which makes it extremely fast and efficient. However, C lacks a true string data type and array bounds, and is instead reliant on the expertise of programmers to manage things. This is a fail. Inevitably even an experienced programmer may fail to spot some place where external data can cause a buffer to be written past the end of the space allocated to it; this is called a "
buffer overflow".
A classic example of a buffer overflow exploit where an Internet-facing daemon (let's call it BadSQL) had a known failure to check bounds, and an attacker established a connection to the BadSQL server and then sent a very long query to the daemon that caused it to stomp on the stack. At the end of the request is some code that executes "/bin/sh". When that returns, suddenly /bin/sh executes and the attacker is given a shell over what used to be a remote SQL connection. If the SQL daemon is running as an unprivileged user, then the attacker may need to find a userland vulnerability to gain access to root. Anyways, lots about that here:
http://www.cis.syr.edu/~wedu/Teaching/IntrCompSec/LectureNotes_New/Buffer_Overflow.pdf
But jails, jails and chroot environments are weird. There's no particular requirement that a jail has to host a copy of /bin/sh. It could host a shell in an alternate location, or, better yet, not at all. For BadSQL, the jail could be chrooted to /badsql and the executable as /badsql/sbin/badsqld (executed inside the jail as /sbin/badsqld) and that could literally be the only executable file within /badsql. Further, it can be running as non-root-user "badsql". This means that even if you're running the swiss-cheese-holes version of badsql from 20 years ago, the worst an attacker can do (aside from trashing your SQL DB) is to cause badsqld to fail and stop running. Since there is no root privilege running inside the chroot environment, it isn't easily possible to execute a chroot/chdir attack to try to break out of the jail, and since there's no /bin/sh and no other executable tools in there anyways to assist in such a breakout attempt, the difficulty of getting a shell is substantially increased. It may still be possible to exploit and break out of such a jail given sufficient resources and some kernel vulnerabilities, but at that point we're talking something much closer to NSA-skill-level hackers than simple script kiddie exploits.
But the task of actually creating a secured jail in this manner is rather more difficult than just running some basic pkg-install commands on a FreeBSD base system in a jail. Instead, you have to start from empty and then fill the jail with the minimal set of things you truly need.