Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flash messages vulnerable to XSS attacks #11448

Closed
Paradoxis opened this issue Feb 25, 2016 · 2 comments
Closed

Flash messages vulnerable to XSS attacks #11448

Paradoxis opened this issue Feb 25, 2016 · 2 comments
Assignees
Labels
bug A bug report status: medium Medium
Milestone

Comments

@Paradoxis
Copy link

Paradoxis commented Feb 25, 2016

Summary

Adding messages to the Phalcon\Flash\Session object will cause the contents of the message to remain unecaped when they are displayed, possibly allowing an attacker to inject HTML into the page (XSS).

  • Class affected: \Phalcon\Flash\Session
  • Method used: {{ flashSession.output() }}

System details

  • Phalcon version: 2.0.10
  • OS: Tested on Ubuntu

Code examples

// Setting the session in my dependency injection object
$di->set('flashSession, function() {
  return new Session([
        'error'   => 'alert alert-danger',
        'success' => 'alert alert-success',
        'notice'  => 'alert alert-info',
        'warning' => 'alert alert-warning'
    ]);
});
// Adding messages inside of a controller
$this->flashSession->success("<script>alert('This will execute as JavaScript!')</script>");
// Echoing out the messages in a volt template (the message is printed as HTML)
{{ flashSession.output() }} 
// Same result (printed as HTML)
{{ flashSession.output() | escape }}
// Also the same result (printed as HTML)
{% autoescape true %}
  {{ flashSession.output() }}
{% endautoescape %}
@googlle
Copy link
Contributor

googlle commented Mar 26, 2016

+1

@sergeyklay sergeyklay added this to the 2.1.0 milestone Mar 26, 2016
@sergeyklay sergeyklay self-assigned this Jun 14, 2016
@sergeyklay
Copy link
Member

Fixed in 2.1.x

@niden niden added bug A bug report status: medium Medium and removed Bug - Medium labels Dec 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A bug report status: medium Medium
Projects
None yet
Development

No branches or pull requests

4 participants