Fri 27 Jun 2008
CFDBinfo — What can you see?
Posted by JC under ColdFusion
No Comments
A month or so ago I had to throw together a script to help with some forensics, it strikes me that it might come in handy for other people, so I'm going to post it here. Just edit the first bit and provide it with your datasource name, and run it. You might need to adjust the timeout settings in ColdFusion Administrator — if your database user has access to a lot of stuff, it could take a very long time to run.
It uses one of the new CF8 tags, CFDBinfo, that hasn't gotten much press. It also highlights something that I found a bit disturbing, though I guess it makes sense… even though you assign a database name to your DSN in CF, CF isn't locked down to that DSN, it can interact with any database on the server that the user you put in there can access.
This snippet of code is also pretty useful — it shows all your DSN settings at once:
<cfset sf = CreateObject("java", "coldfusion.server.ServiceFactory")>
<cfdump var="#sf.DataSourceService.getDatasources()#" expand="true">
With either of these, please exercise caution.. don't put them somewhere anyone but you can execute them, and don't leave them up there any longer than it takes for you to extract the data you need.