You are viewing the PKP Support Forum | PKP Home Wiki

Security error

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Security error

Postby rramos » Tue Oct 09, 2012 12:31 am

It seems the ability to forward a user to a page outside the organitation when performing authentication. This is due to incorrect data validation entry. A potential attacker could use this vulnerability to perform redirects customized without user intervention and thus modified redirect to another page. of This enables you to perform other types of attacks, such as data theft user or session.

In tests carried out in our development servers has been detected in one of the server requests that are made
during the authentication process in the application, there is a parameter "source" in which includes a return address that can be manipulated.

How can we correct this vulnerability?

Posts: 10
Joined: Thu Sep 13, 2012 11:35 pm

Re: Security error

Postby JasonNugent » Wed Oct 10, 2012 6:31 am

Hi rramos,

You're correct, the redirection that occurs after login should be sanitized to ensure that it is to a page within OJS. However, the risk in the current situation is quite low -- someone wishing to redirect you to a page of their choosing would need to a) know that you had an account within an OJS installation or an active session, and b) convince you somehow to follow their crafted link.

I have filed this as a bug at http://pkp.sfu.ca/bugzilla/show_bug.cgi?id=7959 if you wish to add yourself to the CC list in order to be notified when it is fixed.

Site Admin
Posts: 910
Joined: Tue Jan 10, 2006 6:20 am

Re: Security error

Postby rramos » Thu Oct 11, 2012 4:13 am

thank you very much for your help
Posts: 10
Joined: Thu Sep 13, 2012 11:35 pm

Re: Security error

Postby rramos » Fri Nov 09, 2012 1:27 am

If anyone is interested I modified the code:

In this file I created a small patch:
Code: Select all
        function antiXSS(&$source) {
      $str = strpos($source,'/');
      if($str == 0 ) {

and in this other function called my function:

Code: Select all
 function signIn() {
      if (Validation::isLoggedIn()) {
         PKPRequest::redirect(null, 'user');

      if (Config::getVar('security', 'force_login_ssl') && Request::getProtocol() != 'https') {
         // Force SSL connections for login

      $user = Validation::login(Request::getUserVar('username'), Request::getUserVar('password'), $reason, Request::getUserVar('remember') == null ? false : true);
      if ($user !== false) {
         if ($user->getMustChangePassword()) {
            // User must change their password in order to log in
            PKPRequest::redirect(null, null, 'changePassword', $user->getUsername());

         } else {
            $source = Request::getUserVar('source');
            $this->antiXSS($source); // MY FUNCTION

It's silly but it works

Posts: 10
Joined: Thu Sep 13, 2012 11:35 pm

Return to OJS Technical Support

Who is online

Users browsing this forum: No registered users and 0 guests