Securing Your ColdFusionMX Installation on Windows

ColdFusion Add comments

This is an article I have done previously for HELM, I thought I may as well move it to my blog. I have removed any HELM specific stuff. The original post can be found HERE if you also want the additional HELM details.

If your running Coldfusion on your server you need to setup certain permissions and folders to have a secure CF installation.

Firstly in order for .cfm files to work, you need to make sure that coldfusion itself has the correct execute permissions.

PROTECTING THE CFADMINISTRATOR

I suggest that you turn off anonymous access on the web site that you have your coldfusion administrator on, or at least turn off anonymous access on the CFIDE folder. this means you need to login twice, once with a windows login, once with the CFADMIN login, or alternately restrict access by IP address.
If you do not do this, you get a lot of hack attempts on your CFIDE/Administrator folder and you give hackers access to certain files they ay be able to use to their advantage if your not secure.
You should also make sure you do not have the CFDOCS or sample applications installed on your live server.

RDS should also be disabled, but you can leave it enabled for your own use, if you have applied the above security.

CFIDE FOLDER

In order for certain java applet tags (cfgrid etc), classes, Coldfusion generated javascript (e.g. CFFORM) and flash forms to work, there has to be a virtual directory on each web site pointing to the CFIDE.

What you need to do is make another copy of the *original* CFIDE folder elsewhere (preferably in the folder where you store your web sites) and DELETE the ' administrator' and ' adminapi' folders from this copy.

Now use this version of the CFIDE when create the virtual directories for new web sites.

SECURING DANGEROUS TAGS

ColdFusion is NOT protected by the windows security or the IIS anonymous user permissions, if you have any of the dangerous tags enabled, customers will be able to read/write files anywhere on the server.
To avoid this problem and still give customers access to these tags you need the enterprise version of coldfusion so that you can deploy sandbox security. This will need to be manually setup for each web site. If you have the standard edition of CFMX you can only disable the tags globally. This version is therefore not really suited for shared hosting.

The following tags and functions should be disabled on a shared server. All these allow files to be read/written or both anywhere on the server.

  • TAGS
    • CFFILE
    • CFDIRECTORY
    • CFEXECUTE (never enable)
    • CFCONTENT
    • CFHTTP
    • CFOBJECT
    • CFREGISTRY (never enable)
    • CFFTP
    • CFPOP
    • CFLDAP
    • CFMAIL ( this may also be an issue for you, as it allows customers to attach any file on the server to an email)
  • FUNCTIONS
    • GetProfileString
    • SetProfileString
    • CreateObject

      the functions marked as "never enable" will not be affected with a security sandbox and should never be enabled on a live shared server.
      The other tags and functions you can enable in each customers sandbox and they will restrict file access to the root specified in the sandbox files/directories tab.

SANDBOX (cf enterprise edition only)

For each sandbox you setup, you need to add the following paths for each client in the files/dir's tab. Your paths may of course be different than below.
My examples presume a directory configuration thus:-

HomeDir (ftp root, non web accessible)
d:\wwwroot\mydomain.com\
Webroot
d:\wwwroot\mydomain.com\wwwroot

Sandbox paths

\ (e.g. d:\wwwroot\mydomain.com\)
\- (e.g. d:\wwwroot\mydomain.com\-)
NB: The following are for the temp folder to allow file uploads via forms, and to embed fonts using cfdocument
c:\CFusionMX7\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\
c:\CFusionMX7\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\-
c:\windows\fonts\

Correct the first two with the correct path to the clients FTP root (or web root if you do not have a
Correct the last two with the path to your coldfusion installation. These last two paths are required for file uploads to work as the cfusion temp folder is used. Make sure you use LOWER CASE drive letters.

SQL Server and MySQL databases should NOT have the username/password setup in the DATASOURCE in the CFADMIN, so will be safe as the customer only has this info and passes it in their code. If the customer asks for the username/password to be added in the datasource, then this is at their own risk as other clients will be able to run queries against their database if they know or guess the DSN.

On the CFTAGS and FUNCTIONS tabs, simply enable whichever tags and functions you want to allow, excluding the ones I told you to never enable
I suggest that you also do not enable CFOBJECT and CreateObject(java) by default, see Java security section below for why.

The Server/Ports tag should not need any changes.


JAVA SECURITY

Because ColdFusionMX is built on java and runs on a J2EE compliant server, JRUN by default there is absolutely no java security whatsoever from within CF. You customers can do just about anything they want via Java. Including Accessing the Java service factory, which allows them to manipulate all the CFADMINISTRATOR settings. You can even find documentation online how to do this.
Your customers will usually instantiate java classes using the CFOBJECT tag or the CREATEOBJECT(java) function, thus why I said do not enable these by default. Make your customers ask for it, and then ask them why they want it.
Unfortunately these 2 tags/functions are required by some people for CFC's, so some of your customers will need them.
Even without these tags/functions it is possible to instantiate and use java classes, but does require more java programming knowledge than most coldfusion developers are going to have.

CFOBJECT can also be used to call windows COMponents, so make sure you do not have anything installed they can take advantage of or at least have your server locked down with appropriate permissions.

Your only path for having a more secure CFMX is to run a separate instance of coldfusion for each site, which requires you to install the coldfusion for j2ee (multi server) configuration and not the standalone server configuration.
This of course is not very suitable for many sites it requires a lot of manual work plus a huge amount of memory on your server.

Another suggestion is to run the Coldfusion service as a separate user account with limited permissions rather than under the SYSTEM account which has full system access. The new user should only have access to Coldfusion installation itself, the webroot where your sites are located, and and other systems paths which are required, such a windows temp folder, fonts folder etc.

One other possibility is Blue Dragon from new Atlanta, which is another application server that supports the Coldfusion CFML language. You would still need a separate instance for each site, but the footprint is smaller, so is the price.

Hope this helps

Tip for running Coldfusion Professional more securely

If you cannot afford to run the enterprise version for the sandboxing facility, then here is another option.
As mentioned previously, Instead of running coldfusion under the System account, which is the default, create a custom windows user, and run coldfusion under this.

This will still allow customers to access each others files if you enable those dangerous tags, but at least will not give them access to your server and system files so that they can crash the server.

You can also replace the dangerous tags with your own custom tags as wrappers (as I used to do prior to CFMX). In your wrapper tags you call the original tags (as the custom tags folder will still have access to them) and pass the arguments, you can then control which paths they have access to.

6 responses to “Securing Your ColdFusionMX Installation on Windows”

  1. charlie arehart Says:
    Hey Russ, since this is being pointed at recently due to the burst of discussions today on one CFIDE exploit, I wanted to share just a couple of observations.
    Granted, I realize this is an old post (no sign of a year of its publication, but I see the references to cfusionmx7, so I'll assume it was written around that time).
    First, some readers may see the list of things that the CFIDE/scripts is needed for (you mention java applets, cfform and flash forms), and they may think, "well we don't use those, so let's just block it". Well, be careful. Since CF8, all the Ajax stuff also leverages files in that folder. So really, one should be very careful about just blocking the entire CFIDE.
    I realize you don't propose they do that, Russ. I mean that some may infer it themselves. Since the Ajax stuff is new since CF8, I understand why it's not mentioned here. Just trying to help future readers.
    But second, another change since CF8 is that (as I'm sure you know, Russ) many of the hotfixes, cumulative htofixes, and security hotfixes now entail updating the CFIDE directory.
    If one follows the advice of creating a copy and removing the administreator and adminapi folders, it's then CRITICAL that they be very careful whenever applying any updates to be sure to update ALL the copies of CFIDE that they have, when extracting them from the zip in the update files. (And of course, then they'd need to remove any /administrator or /adminapi folders that the zip extraction might have created in the "copied" version where you propose removing them.)
    An argument could be made that those on web servers like IIS or Apache could instead use virtual folders or other means to instead create virtual links to the files (in the sites where the real Admin is not desired), but I realize that was beyond the scope of what you wanted to discuss here.
    Hope that's helpful.
  2. larde pierre Says:
    This afraid me very much.
    I run CF9 in production.
    I found these files h.cfm and i.cfm
    in the CFIDE directory dated from the 24 april 2013.
    I have deleted them, is that good ?
    What are these files.
    Can I disable the CFIDE directory access with a new :
    application.cfm file with a <cfabort> in it ?

    Thanks for any answer.
    Pierre.
  3. Lartde Pierre Says:
    I understand well now, I hope.
    There is a mixup in the CFIDE, CF administration engine and scripts used in the code.
    So what I did, I have created a minimal CFIDE with the scripts, and I copy this directory in any new created Web Site.(I run with CF installed on C and sites installed on D), and I put a <cfabort> in the admin CFIDE which I can switch back.
    I am very desapointed about this CF architecture.
    I am not a guru, a very small dvelopper, but this seems to me a big mistake ?
    But I still love CF.
  4. Russ Michaels Says:
    You can always take a look at railo instead, it doesn't have these issues. But you also do not need the CFIDE at all if you do not use any of the CF built in UI tags, which TBH you are best off not using anyway, use JQuery, twitter bootstrap, and all the other free js libraries directly instead.
  5. Larde Pierre Says:
    Thanks for answer,
    This is my plan, to invest myself into Railo in coming months. I run under Windows Sever 2008 and IIS7.
    I hope Railo is compatible with these.
    I do not want to reskill myself in all domains.
    I am folowing the team-cf-advance group.
  6. Russ Michaels Says:
    yes it works fine on that setup, you can also try it out at www.cfmldeveloper.com

Leave a Reply

Leave this field empty

Powered by Mango Blog. Design and Icons by N.Design Studio