Bug 19108 - Stored XSS in biblio_framework.pl and marctagstructure.pl

To Test
1. Hit the page /cgi-bin/koha/admin/biblio_framework.pl?op=add_form
2. Add a text in the field Description that contains js
3. Save the page.
4. Notice js is execute
5. Click on Actions -> MARC structure
6. Apply patch and reload, the js is escaped

Fixed for both the pages biblio_framework.pl and marctagstructure.pl

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mason James <mtj@kohaaloha.com>
This commit is contained in:
Amit Gupta 2017-08-15 14:37:50 +05:30 committed by Mason James
parent 280750052a
commit 8dc404940d
2 changed files with 15 additions and 15 deletions

View File

@ -3,7 +3,7 @@
[% IF op == 'add_form' %]
&rsaquo; [% IF framework %]Modify framework text[% ELSE %]Add framework[% END %]
[% ELSIF op == 'delete_confirm' %]
&rsaquo; Delete framework for [% framework.frameworktext %] ([% framework.frameworkcode %])?
&rsaquo; Delete framework for [% framework.frameworktext |html %] ([% framework.frameworkcode %])?
[% END %]
</title>
[% INCLUDE 'doc-head-close.inc' %]
@ -31,7 +31,7 @@
[% IF op == 'add_form' %]
&rsaquo; [% IF framework %]Modify framework text[% ELSE %]Add framework[% END %]
[% ELSIF op == 'delete_confirm' %]
&rsaquo; Delete framework for [% framework.frameworktext %] ([% framework.frameworkcode %])?
&rsaquo; Delete framework for [% framework.frameworktext |html %] ([% framework.frameworkcode %])?
[% END %]
</div>
@ -107,13 +107,13 @@
<div class="dialog alert">
[% IF biblios_use_this_framework %]
<h3>This framework cannot be deleted</h3>
<p><strong><span class="ex">[% framework.frameworktext %] ([% framework.frameworkcode %])</span></strong></p>
<p><strong><span class="ex">[% framework.frameworktext |text %] ([% framework.frameworkcode %])</span></strong></p>
<p>The framework is used [% biblios_use_this_framework %] times.</p>
<form action="/cgi-bin/koha/admin/biblio_framework.pl" method="get">
<button type="submit"><i class="fa fa-fw fa-arrow-left"></i> Return to frameworks</button>
</form>
[% ELSE %]
<h3>Delete framework for [% framework.frameworktext %] ([% framework.frameworkcode %])?</h3>
<h3>Delete framework for [% framework.frameworktext |html %] ([% framework.frameworkcode %])?</h3>
<form class="inline" action="/cgi-bin/koha/admin/biblio_framework.pl" method="post">
<input type="hidden" name="op" value="delete_confirmed" />
<input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
@ -201,7 +201,7 @@
[% FOREACH loo IN frameworks %]
<tr>
<td>[% loo.frameworkcode %]</td>
<td>[% loo.frameworktext %]</td>
<td>[% loo.frameworktext |html %]</td>
<td>
<div class="dropdown">
<a class="btn btn-mini dropdown-toggle" id="frameworkactions[% loo.frameworkcode %]" role="button" data-toggle="dropdown" href="#">
@ -220,7 +220,7 @@
<div class="modal hide" id="exportModal_[% loo.frameworkcode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]" aria-hidden="true">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]">Export [% loo.frameworktext %] framework</h3>
<h3 id="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]">Export [% loo.frameworktext |html %] framework</h3>
</div>
<form action="import_export_framework.pl" name="form_[% loo.frameworkcode %]" method="get" target="_blank" class="form_export">
<div class="modal-body">

View File

@ -33,15 +33,15 @@ $(document).ready(function() {
&rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
&rsaquo; <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a>
[% IF ( add_form ) %]
&rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% frameworktext %] ([% frameworkcode %])</a>
&rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% IF framework %][% framework.frameworktext |html %] ([% framework.frameworkcode %])[% ELSE %]Default MARC framework[% END%]</a>
&rsaquo; [% action %] [% searchfield %]
[% ELSIF ( else ) %]
&rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% IF ( frameworkcode ) %][% frameworktext %] ([% frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a>
&rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% IF framework %][% framework.frameworktext |html %] ([% framework.frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a>
[% ELSIF ( delete_confirm ) %]
&rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% frameworktext %] ([% frameworkcode %])</a>
&rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% IF framework %][% framework.frameworktext |html %] ([% framework.frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a>
&rsaquo; Confirm deletion of tag '[% searchfield %]'
[% ELSIF ( delete_confirmed ) %]
&rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode %]">[% frameworktext %] ([% frameworkcode %])</a>
&rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% IF framework %][% framework.frameworktext |html %] ([% framework.frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a>
&rsaquo; Data deleted
[% END %]
</div>
@ -56,7 +56,7 @@ $(document).ready(function() {
<a class="btn btn-small" id="addtag" href="/cgi-bin/koha/admin/marctagstructure.pl?op=add_form&amp;frameworkcode=[% frameworkcode %]"><i class="fa fa-plus"></i> New tag</a>
</div>[% END %]
<h1>MARC Framework for [% IF ( frameworkcode ) %][% frameworktext %] ([% frameworkcode %])[% ELSE %]default MARC framework[% END %]</h1>
<h1>MARC Framework for [% IF ( frameworkcode ) %][% frameworktext |html %] ([% frameworkcode %])[% ELSE %]default MARC framework[% END %]</h1>
[% IF ( add_form ) %]
@ -142,11 +142,11 @@ $(document).ready(function() {
<form action="[% script_name %]" method="post">
<input type="hidden" name="op" value="framework_create_confirm" />
<input type="hidden" name="frameworkcode" value="[% frameworkcode %]" />
Create framework for [% frameworkcode %] ([% frameworktext %]) using
Create framework for [% frameworkcode %] ([% frameworktext |html %]) using
<select name="existingframeworkcode">
<option value="">Default</option>
[% FOREACH existingframeworkloo IN existingframeworkloop %]
<option value="[% existingframeworkloo.value %]">[% existingframeworkloo.frameworktext %]</option>
<option value="[% existingframeworkloo.value %]">[% existingframeworkloo.frameworktext |html %]</option>
[% END %]
</select>
<input type="submit" value="OK" />
@ -165,9 +165,9 @@ $(document).ready(function() {
<option value="">Default</option>
[% FOREACH frameworkloo IN frameworkloop %]
[% IF ( frameworkloo.selected ) %]
<option value="[% frameworkloo.value %]" selected="selected">[% frameworkloo.frameworktext %]</option>
<option value="[% frameworkloo.value %]" selected="selected">[% frameworkloo.frameworktext |html %]</option>
[% ELSE %]
<option value="[% frameworkloo.value %]">[% frameworkloo.frameworktext %]</option>
<option value="[% frameworkloo.value %]">[% frameworkloo.frameworktext |html %]</option>
[% END %]
[% END %]
</select>