Shared memory space. If you run multiple applications within a single JVM, they are by definition sharing a single memory space and will compete for resources. If you want isolated memory spaces, you really need to run multiple JVMs - one per application. That's why ColdFusion Enterprise lets you run multiple server instances. Yes, that might eat up resources but that's the price you pay for isolation.
The application context. What is an "application" really? In J2EE, the notion of an application is a bit fuzzy but if you look at Servlets in particular, you see that all Servlets that operate in a single context root share a single Servlet context - a single application context. ColdFusion is usually installed under a single context root (typically "/cfusion") and therefore all applications running inside that ColdFusion installation will, by definition, share that single application context.
Servlets and sharing. In the Servlet world, if you have a bunch of Servlets under the "/foo" context root, then they all share a single application context and can use it to exchange common data. If you have another bunch of Servlets under the "/bar" context root, then they all share a single application context - but it is a different application context to the Servlets running under "/foo". Yes, even in the same server instance.
Ah, so you don't have to use separate server instances to get separate application contexts? Right, you can use multiple context roots within a single server instance. What does that mean for ColdFusion? Well, you could perform multiple installs of ColdFusion within a single server instance just using separate context roots. A shared host environment could actually have a completely separate install for every customer, all within a single server instance. All of those installations would share the JVM memory space and compete directly for resources within that JVM - but that's already true if you have multiple customers on a single ColdFusion installation anyway.
ColdFusion "applications". The other thing to bear in mind is that ColdFusion's notion of application is even fuzzier than J2EE's. You define an application in ColdFusion purely as a runtime programming convention. What I mean is that a single page can be part of any application, determined purely by the name= attribute in the <cfapplication> tag. For example:
<cfapplication name="#url.appname#">
<cfoutput>
<p>Hi, I'm the #application.applicationName# application!</p>
</cfoutput>
It should be clear from this that multiple ColdFusion "applications" running within a single installation of ColdFusion itself would all share the same Servlet application context and, since ColdFusion and Java are interoperable via the Servlet machinery, it isn't too hard to "snoop" across application scopes - because they are all part of the same Servlet application context.
The solution to this apparent "security risk" - which exists in the underlying J2EE architecture by design - is to use separate server instances (i.e., JVMs) or at least use separate Servlet contexts (multiple ColdFusion installs within a single server instance).
I would suggest however that this is more than an "apparent security risk". The risk is real. The fact that the risk can be mitigated, or even eliminated doesn't change the fact that the risk exists. Especially since many people are in a shared hosting situation.
The important thing is that people know the risk is there, and can than plan accordingly.
Ignoring whether or not this facility is by design or not, this issue combined with the server-mapping snooping risk seems to leave CF Standard Edition accounts (as configured by most hosting services) on shared servers, looking less than secure, it has to be said.
At the very least, it sounds like obfuscated, non-guessable cfapplication names should be used without fail for typical, non-enterprise shared-server accounts.
Are you saying that within such shared setups, if two customers both happen to choose the same application name, and, for example, one <cfdump>s her application scope, she gets to see the other customer's app variables as well as her own?
However, if you DO have an application on a shared server which held sensitive information, etc., others being able to access shared scopes is really the least of your worries.
If a hosting provider offers an account aimed at small businesses, with SSL, etc. They should ensure that the data is acceptably secure (or else at the very least, make the customer perfectly aware of the risks). I'm not sure that snoop-able server mappings and application data counts as acceptably secure in anyone's book.
Talking about sandboxes, what I don't understand (but I believe there's a good reason) is why sandbox security (a more feasible approach for traditional shared enviroments) does not isolate application and other shared escopes. This is something difficult to implement?
If you have two Servlet applications in the same context root, they share their application context. You need to place them in separate context roots to isolate them as far as application context is concerned, and you need to place them in separate server instances to isolate as far as memory space is concerned.
If you don't want your applications to be that exposed, you must pay the extra cost to get a dedicated context root or a dedicated server instance.
Someone in the cf-talk thread drew an analogy with car safety - it backfired because someone pointed out that the base model has a given safety level but spending more money gets you vehicle stability control, more airbags, anti-theft devices etc. Security costs money - that's a fact of life.
If you're worried about sensitive data in application scope, don't store any there - or use strong encryption! If you want the luxury of storing sensitive data in application scope, perhaps for caching to enhance performance, then pay the money to get your own context root / server instance. Besides, if you want high-performance, you probably ought to be looking at a dedicated server anyway. If an ecommerce business cannot afford $1,000 a year in hosting fees for a dedicated server...
Non-guessable application names won't make a lick of difference - you can actually iterate through all of the applications on a given shared-instance server using some of CF's underlying factory methods. The code is available on numerous sites.
<cfapplication name=""> <cfdump var="#application#">
Hopefully more hosts will start switching to dedicated CF instances via the new CF7 multi-instance functionality.
Security sandboxes does not address the issue but it should. If not, there's no reason for Macromedia to say sandbox security is a "plus" for the Enterprise version. It does not isolate things as it should. In the CF7 we have (finally) the option to use CreateObject() and CFOBJECT to invoke our CFCs without risking the server opening access to the CF service factory and the underlying Java runtime, but we still need better isolation. What about a "application" isolation level, just like we have for datasources and etc?
Again, I don't understand why is not possible to do that with sandboxes.
You make the point that no one would use email to send sensitive details. Email's security issues are well-publicized and widely known. However, I don't think many shared-hosting ColdFusion users, whether "Mom & Pop" sites, personal blogs, small businesses, whoever, are fully aware of the fact much of their key data is wide open on many shared server installations. This is borne out by the reactions of many developers on the various forums and mailing lists when they learn of the realities. Sensitive data isn't just passwords and customer details, it's any data that relates to the person or business.
I've just been able to loop through the application structs of each of the applications on one of several shared CF Servers that I have access to - and have found the DSN names and passwords of many of the users on the system. It gets even more interesting and sobering when Fusebox is being used - as I'm sure Fusebox users can imagine with the whole application stored in application scope.
Many of the more experienced developers on the CF-Talk thread reacted with smug disdain when the issue was discussed. "What, you didn't know? (Subtext: You shouldn't be using ColdFusion if you're that ignorant...). OK, so that's the deal. I thus assume that those in the know will from now on routinely include clauses within their blog and site FAQs that ColdFusion on shared servers isn't secure. I assume Macromedia will instruct their resellers to make it *perfectly* clear that this is the case (I've used about four CF resellers now and none have ever mentioned the risks of using shared scope data as a mechanism for storing sensitive data, or that the mechanism is exposed on typical shared hosting setups).
I don't understand the "you get what you pay for" argument in the context of security. While I acknowledge that no system is perfect and that dedicated servers have inherently less risks attached for the obvious reasons, I don't accept that low-cost should mean that application-internal data is exposed. Gmail and Yahoo are free, but they don't take this attitude. Mobile telecomms is an industry that sells aggresively on price, it doesn't take that attitude (yes, I know the tech is different, but the principle remains)
If low-cost hosting solutions are inherently insecure and inevitably involve low levels of data security, then let the hosting industry as a whole be open and up front about that instead of allowing the perpetuation of the current common misconceptions.
Sean, I share your exasperation regarding companies who want to do online retailing but who are prepared to shell out little more than pocket money each month for the privilege, but I don't think that this has much bearing on the fundamental issue. I expect free gmail to keep my data secure regardless of whether I use the service for business or pleasure.
(apologies for the long post)
I understand your argument...and I hope I did not appear smug in my post. While I understand that not everyone is aware of the risk, that is not exactly what is going on. I am glad the risk is getting some publicity here, but this discussion seems more about whether this risk should exist (as I believe most posts here are from people who are aware of the risk..and the same went for the posts on CF-Talk).
I do think you get what you pay for in this instance, as what we are asking from a shared host to remedy this issue would directly affect the profitability of the product (i.e. creating a unique instance of CF for each site on a shared server). I have not looked into this, but I would be willing to bet that someone offers this level of service on a shared server - for a price.
I think the car analogy mentioned earlier works well here. I can get a car with all the safety features and spend more or I can get one with limited safety features and spend less. That I am aware of the difference is important, but in the end that difference will exist regardless of how wonderful it would be to get those features for the same price.
Seems like it's the hosting services' responsibility to inform users of this risk, not MACR, no? And, at some level, isn't it the developers responsibility to understand the tools they use?
While I knew of the existence of undocumented methods, I had assumed that their use would be blocked within shared environments, at least for those that could be used to access memory not connected with the current app. Boy, am I feeling naive.
In a shared hosting environment someone could also instantiate your CFCs and (assuming CFFILE and CFOBJECT/createObject are not disabled) read all your files.
Again, this is not some kind of failing in ColdFusion -- it's an inherent part of the shared hosting configuration.
I'm still hoping someone can answer the question about how PHP and other environments deal with this.
Also, for traditional JSP hosting, AFAIK (folks, please correct if I'm wrong!!) you must have multiple instances just like CF/JRun to address the issue, but since you don't need to install/deploy CFMX (a not so lite java app that sits ontop of your Java server), you need less resources to do it, making a shared (low cost) approach more feasible than a Java with CFML support.
HTH, Alan
Now then, if the best solution is to handle this App Scope Security Breach by correctly leveraging J2EE by making multiple JVM's then by all means provide a solution out-of-the-box which means Macromedia/Adobe should provide an automated means of making multiple instances of the JVM each capable of having a separate instance of ColdFusion without having to worry about licensing issues. Personally I feel single-CPU licenses should allow unlimited usage of instances of a product as long as all instances run on the same CPU - unless this is not a licensing issue at all and then I consider it less than desirable for Macromedia to leave it up to those who know how to properly setup a multiple JVM setup in order to be able to have no App Scope Security holes.
These are the points I was trying to make before in my prior comment(s).
The setup that seems to be missing from the picture then would be a single JVM with many instances of CF Server or am I still confused ?
1. Use the CF Admin to clone the master instance to a new server instance.
2. Use the JMC (JRun Management Console, port 8000) on the new server to modify the context root path.
Repeat (1) and (2) as necessary. Step (1) always clones the instance, including the context root, so this process ends up creating multiple context roots / CFMX installs on a single server instance.
Give the new server instance a name and click Submit.
That's it.
Now, what about the context root path - what path would I use and how would I know what it should be ?
Obviously they are very dangerous in shared hosting environments but this is not a bug in ColdFusion but the responsibility of the hosting provider - (i.e. disable createObject('java').
If the hosting provider allows users to ftp out of their shared website directory it is not the operating systems fault - just the configuration of the server (i.e. the Hosting providers fault)
A more secure place to keep your DSN's and usernames and passwords may be the request scope as it does not persist - and the overhead would be minimal.


