SOME BACKGROUND:
I use onCFCRequest() to handle remote CFC calls separately from regular CFM page requests. This allows me to detect errors and set MIME types for all remote requests.
PROBLEM:
I accidentally set some of my remote CFC functions to public access instead of remote and realized that they still work when called remotely.
As you can see below, my implementation of onCFCRequest() created a vulnerable security hole for my entire application, where an HTTP request could be used to call any public method for any available HTTP-CFC.
REPROP CODE:
In Application.cfc:
public any function onCFCRequest(string cfc, string method, struct args){ cfc = createObject('component', cfc); return evaluate('cfc.#method#(argumentCollection=args)'); }
In a CFC called remotely:
public any function publicFunction(){ return 'Public function called remotely!'; }
Question:
I know that I can check the metadata for a component before calling the method to check if it allows remote access, but are there other ways to solve this problem?
imthepitts
source share