Skip to content

Commit

Permalink
Add form security token to permalink_page.php
Browse files Browse the repository at this point in the history
John Page aka hyp3rlinx / ApparitionSec http://hyp3rlinx.altervista.org
reported a CSRF vulnerability in permalink_page.php, allowing an
attacker to inject arbitrary links (CVE-2017-7620).

The security token prevents such injection.

Fixes #22702
  • Loading branch information
dregad committed May 20, 2017
1 parent 2d541e9 commit f21b56f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/filter_api.php
Expand Up @@ -2451,8 +2451,11 @@ function filter_draw_selection_area2( $p_page_number, $p_for_screen = true, $p_e
filter_print_view_type_toggle( $t_url, $t_filter['_view_type'] );

if( access_has_project_level( config_get( 'create_permalink_threshold' ) ) ) {
# Add CSRF protection, see #22702
$t_permalink_url = urlencode( filter_get_url( $t_filter ) )
. form_security_param( 'permalink' );
echo '<li>';
echo '<a href="permalink_page.php?url=' . urlencode( filter_get_url( $t_filter ) ) . '">';
echo '<a href="permalink_page.php?url=' . $t_permalink_url . '">';
echo '<i class="ace-icon fa fa-link"></i>&#160;&#160;' . lang_get( 'create_filter_link' );
echo '</a>';
echo '</li>';
Expand Down
4 changes: 4 additions & 0 deletions permalink_page.php
Expand Up @@ -36,13 +36,16 @@
require_once( 'core.php' );
require_api( 'access_api.php' );
require_api( 'config_api.php' );
require_api( 'form_api.php' );
require_api( 'gpc_api.php' );
require_api( 'html_api.php' );
require_api( 'lang_api.php' );
require_api( 'print_api.php' );
require_api( 'string_api.php' );
require_api( 'utility_api.php' );

form_security_validate( 'permalink' );

layout_page_header();

layout_page_begin();
Expand Down Expand Up @@ -75,4 +78,5 @@
?>
</div>
<?php
form_security_purge( 'permalink' );
layout_page_end();

0 comments on commit f21b56f

Please sign in to comment.