WSO2 Identity Server login returns a 403

Viewed 1716

I am trying to log into my WSO2 management console. It is containerized and hosted in an AWS EC2 instance. I can navigate to the console login page, but when I try to login I get a 403 Forbidden message.

Navigation to login page is okay

enter image description here

Forbidden error

enter image description here

I know that the cause of this issue is that my login page is not posting the X-CSRF-Token.

Example of the form data posted in my "bad" request:

enter image description here

The console of my WSO2 instance prints an error like this:

WARN {org.owasp.csrfguard.log.JavaLogger} - potential cross-site request forgery (CSRF) attack thwarted (user:<anonymous>, ip:IP_ADDRESS, method:POST, uri:/carbon/admin/login_action.jsp, error:required token is missing from the request)

Example of the form data posted in a "good" request in a local WSO2 instance:

enter image description here

What I have tried:

I have tried turning compression "off" as suggested by this post: wso2 api manger carbon page gives 403 Forbidden

I am not using JDK 1.8.0_151 which is labeled as a version with a bug.

I am able to circumvent the issue if I disable the csrfguard in Owasp.CsrfGuard.Carbon.properties but this is a security risk.

I have sticky sessions enabled

Any ideas on why the posting to the login_action.jsp page would return a 403?

EDIT

I failed to mention in the post that I am using TLS termination with an AWS load balancer. I am almost certain that my issue has something to do with that. This line from my console output details what my error is:

Referer domain https:LOAD_BALANCER_URL/carbon/admin/login.jsp does not match request domain: http://LOAD_BALANCER_URL/carbon/admin/js/csrfPrevention.js

You can see that the referer is using https but the request is using http. I believe that I want the request domain to be https, but I'm not sure how to do that. I think that the first page is making a call to login.jsp with https and the login.jsp page is making a call to the csrfPrevention.js page but changing the protocol to http.

3 Answers

Lower the version of java JDK to 1.8.0_144.If it's not worked go to this location wso2Servers/wso2is-5.5.0/repository/conf/security . There is a file name Owasp.CsrfGuard.Carbon.properties.

In that file, there is a line org.owasp.csrfguard.JavascriptServlet.refererMatchDomain = true

set this to org.owasp.csrfguard.JavascriptServlet.refererMatchDomain = false

This worked for me.

Related