Wings of Hermes – Berin's Infosec Blog

Infosec the world and everything

Very annoying. Mysql jdbc connection, defined in glassfish and Netbeans can’t load it. Again no helpful hints anywhere except bug entries for netbeans.

Turns out if you add a “driverClass” property to the connection pool with value “com.mysql.jdbc.Driver” the problem goes away.

Obvious really….

Just ran into a great error on upgrading to Glassfish 4.  Couple of references to it from Google but no solution.

Glassfish log:

[2013-12-22T07:02:51.014+1100] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=36 _ThreadName=admin-listener(4)] [timeMillis: 1387656171014] [levelValue: 1000] [[
  Exception while loading the app : CDI deployment failure:WELD-001301 Annotation @org.glassfish.api.admin.RestEndpoints(value=[@org.glassfish.api.admin.RestEndpoint(description=disable-secure-admin, path=disable-secure-admin, opType=POST, params=[], useForAuthorization=false, configBean=interface com.sun.enterprise.config.serverbeans.Domain)]) is not a qualifier
org.jboss.weld.exceptions.IllegalArgumentException: WELD-001301 Annotation @org.glassfish.api.admin.RestEndpoints(value=[@org.glassfish.api.admin.RestEndpoint(description=disable-secure-admin, path=disable-secure-admin, opType=POST, params=[], useForAuthorization=false, configBean=interface com.sun.enterprise.config.serverbeans.Domain)]) is not a qualifier

Turns out I had some modules from Glassfish included into a library in the project so I could compile some EJBs.  Turns out as well that including that library in the deployed EAR is a bad idea :).

Simply told Netbeans not to package it in the Project Properties -> Libraries page and all was good again.

Simple error – only put it here because I couldn’t find anything on the net.  Had to do the hard yards myself.  Hate that!

Oh yes – and you have to clean and build otherwise the library doesn’t get cleaned out from the build directory.  (I know it’s obvious – but it messed me up for a while.)

I’ve been messing around with the Windows LSA and implementing my own authentication package. It’s all part of an authentication server I’m building.  The *NIX component (a PAM module) was pulled together in an afternoon.

Windows is a slightly different story…..

As always, MSDN has great documentation on the APIs, but there is not a lot of other reference material out there.  I did find an article on building an LSA proxy which was some help, but there was no real source code to work from.

For anyone looking to implement an SSP/AP, a couple of things to remember…

  • Use a virtual machine with nothing on it bu Windows for testing.  Make sure you have a Restore Point – you will break the boot process frequently!
  • Remember to copy the Visual Studio shared runtime library over to \windows\System32 on your build system. (OK should have been obvious :) ).  When LSASS.EXE can’t load a DLL it just ignores it quietly.  No error, no nothing.
  • Build the right architecture for your test system (yeah – again obvious…)

There were some other things I found interesting.  The API talks about a function table that both the Sp and the Ap functions should be registered in.  Interestingly MSV1_0 (the NTLM authentication library) doesn’t include all the Ap functions in the table.  So you need to find them in the DLL exports.  Seems to be a hangover from old implementation I guess.

Anyway – in the interests of helping others out there, the source codefor a basic proxy can be found here.

It’s got the VS 2012 project in there.  Just compile it, copy the DLL to \Windows\System32 on your test system and then add the library name to the list of library names in the following registry key:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\Security Packages

Hope it’s of use to someone.  The Pwitc name is the name of the authentication server I’m building – just pretend it says "LsassProxy" or somesuch!

 

I have just spent the arvo playing with IPv6 and brought up a tunnel using my web server as the tunnel endpoint in my network.

Next thing I know every machine on the network (OS X/Windows/Linux) have been allocated IPv6 addresses in the /56 network I requested from the broker.  Turns out I activated the routing functionality and all the machines on the network received a broadcast routing update.  IPv6 has a thing called stateless autoconfiguration that the devices then use to grab an IP address (based off the MAC address).

And because the tunnel goes through the firewall, everything is visible on the Internet (found a nice site that lets you port scan IPv6 addresses and verified).

As IPv6 becomes more available, I wonder how many people are going to find themselves opening up their network without realising it?  I wonder also if the bad guys have started scanning IPv6 address ranges – or is it still not worth the effort.  And if so – for how long.

Now playing with ip6tables before I bring that tunnel back up…..

I just upgraded from Glassfish 3.1 to 3.1.1 and all logging for my app below INFO (i.e. FINE/FINER/FINEST) stopped working.  Turns out there is a bug that normally expresses itself by stopping logging working altogether.  I think another symptom is glassfish starts to ignore logging if the level for the particular logger is set to FINE or below.

Anyway – fix seems to be to run the command:

asadmin set-log-levels com.sun.enterprise.server.logging.GFFileHandler=ALL

For more info see the 3.11 Release Notes

Well – JAAS and GlassFish. I naively assumed this would be easy to get to work. It’s not.

I started out by building a login module that extended AppservPasswordLoginModule and plugging it directly into login.conf. I then created a Realm that used it and continued on my merry way.

The moment I tried to extend beyond a simple user name and password (being passed through vi the j_security_check form) things broke down.

It turns out that the Realms in GlassFish don’t allow you to plug in “any” JAAS compliant LoginModule. In fact they seem to assume that any kind of authentication you want to do relies on username and password. That makes sense as the realm handles the user input, so if you want to deviate from that standard, you need to go outside what the realm can handle.

In the end, I ended up implementing a JSR 196 SAM (ServerAuthModule). This in turn was an interesting exercise – much of the stuff that GlassFish looks after for you in configuration now needs to be handled directly. For example detecting a not logged in user and redirecting to a login page and then redirecting back when the auth occurs. My SAM plugs direct into GlassFish and I no longer use the realm for those parts of the app with my customised authentication process.

Very interesting. But I now have a SAM that operates as a login bridge and calls a JAAS LoginModule implementation for my authentication.


Patrick Hogan has done a great project on GitHub – IOS Certificate Key and Trust Sample Project – that pulls together all the concepts for RSA key importing/exporting and handling. It’s used some of the code from my import and export posts + code from a few other places together with his own work. Great single place to go for guidance in this space.

Awesome! Wish I’d thought of it :).


One of the biggest issues with security awareness is knowing what it is you are trying to achieve. It’s not enough to just run an awareness program – you have to be trying to drive an outcome.

Over a period of time I have defined in my own head a kind of CMM for security awareness. It’s something that helps me think about how mature is an organisation in its security awareness culture, which in turn helps me guide an awareness program to continually improve that culture.

It’s not really a CMM in the sense of measuring maturity process – it’s more looking at the output of all the awareness processes than measuring the processes themselves. But it’s a nice analogy that works for me.

A good CMM always has five levels (paraphrasing from the wikipedia article referenced above) :

 

  1. Initial – ad-hoc process
  2. Repeatable – Trying to do the same thing every time
  3. Defined - Documented as a standard business process
  4. Managed – Good metrics that measure success of the process
  5. Optimising – ongoing improvement

To make use of this, I try to put myself in the shoes of Fred Bloggs, some person in the organisation (not in the Information Security team) and I measure culture using statements to represent the way Fred is thinking:

  • Initial – “I know there is a security team and they’ll look after all that security stuff. I don’t need to do anything”.
  • Repeatable – “I’ll drag the information security person into this conversation – he/she will worry about the security requirements”.
  • Defined – “I know what the security requirements are, but I’ll drag the security team in anyway as they will do the ‘fighting’ for what is required”.
  • Managed – “I know the security requirements and I’ll fight for them because we need them. I’ll use the security team for final sign-off or where I have to escalate”.
  • Optimising – Security requirements are just inherent in everything people do.

Of course the above is quite a naive way of looking at things in some ways, but a key part of an awareness program is understanding where you are and what you are trying to achieve. By knowing roughly where your organisation culture sits and what you want to take it to, you can start to taylor your security awareness program to achieve that next step.

One last thing to note – different parts of an organisation will be at different levels, and probably should be. Having an IT team that is higher up the scale than the rest of the organisation might not be a bad place for the company you are looking at. And of course that’s another key part of awareness – understanding there are different messages and results that you want for different groups.


I was doing some reading on the distribute.it hack and stumbled onto a reference to a Risky Business podcast on probablistic risk assessments.

It’s a great argument as to why risk assessment does not work well in the information security space.  The basic thesis is you can’t assign a probability to a serious attacker.    We’ve built a whole risk model on the idea that we can assign a probability to various events – we treat risk in a malicous environment as we would in a "normal" environment.  We have a certain risk of machine failure therefore we have a similarly measurable risk on a malicious attacker and of course these two are not equivalent at all.

A great interview to listen to.

I read No pic, no fly plan for airports in The Age yesterday with a small amount of dismay.  It’s always frustrating to see security measures that seem to be more about the appearance of security rather than the reality, and which will negatively impact the users (or travellers in this case).

I’m really not sure how having to produce a photo ID will really slow down the determined criminal or terrorist. I’m pretty sure it’s not going to give them pause for thought.

And as for signing a stat-dec if you don’t have ID – what does that achieve?

I do like the idea of getting a newborn to sign a stat dec tho….