Project

General

Profile

Actions

Bug #64348

closed

preg_replace in removeBadHTML crashes with lots of responsive image

Added by Sebastian Fischer almost 10 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Frontend
Target version:
-
Start date:
2015-01-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

We have a case where 6 images get rendered in 6 different sizes for responsive image in data-* variant. These get checked by removeBadHTML. In removeBadHTML the preg_replace crashes (return NULL) and thats why the content does not get outputted.

By reducing the amout of options in these line

'\'<\\w+.*?(onabort|onbeforeunload|onblur|onchange|onclick|ondblclick|ondragdrop|onerror|onfilterchange|onfocus|onhelp|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onmove|onreadystatechange|onreset|onresize|onscroll|onselect|onselectstart|onsubmit|onunload).*?>\'si'

we got it back working.


Files

broken_image_example.html (7.9 KB) broken_image_example.html Sebastian Fischer, 2015-01-22 10:15
Actions #1

Updated by Mathias Schreiber almost 10 years ago

  • Target version set to 7.2 (Frontend)

Care to provide a patch?

Actions #2

Updated by Sebastian Fischer almost 10 years ago

As im not the greatest regex profi i would like to give the following into consideration:

'\'<\\w+.*?(on{4,16}=).*?>\'si',

This would search for all on(click,blur,...)= in the string and replaces the occurance.

If none is against this i could provide a review.

Actions #3

Updated by Gerrit Code Review almost 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36161

Actions #4

Updated by Mathias Brodala almost 10 years ago

Could this be the same issue as #64033?

Actions #5

Updated by Stephan Großberndt almost 10 years ago

Sebastian, please provide the string of one image you got preg_replace to crash with for testing.

Actions #6

Updated by Sebastian Fischer almost 10 years ago

I attached an html file with the exact contentpart that was broken after the preg_replace in removeBadHTML

Actions #7

Updated by Gerrit Code Review almost 10 years ago

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #8

Updated by Gerrit Code Review almost 10 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #9

Updated by Gerrit Code Review over 9 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #10

Updated by Gerrit Code Review over 9 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #11

Updated by Gerrit Code Review over 9 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #12

Updated by Gerrit Code Review over 9 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #13

Updated by Gerrit Code Review over 9 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #14

Updated by Gerrit Code Review over 9 years ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #15

Updated by Gerrit Code Review over 9 years ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #16

Updated by Gerrit Code Review over 9 years ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #17

Updated by Gerrit Code Review over 9 years ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #18

Updated by Gerrit Code Review over 9 years ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #19

Updated by Gerrit Code Review over 9 years ago

Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #20

Updated by Gerrit Code Review over 9 years ago

Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36603

Actions #21

Updated by Markus Klein over 9 years ago

  • TYPO3 Version changed from 7 to 6.2
Actions #22

Updated by Benni Mack over 9 years ago

  • Target version changed from 7.2 (Frontend) to 7.4 (Backend)
Actions #23

Updated by Susanne Moog over 9 years ago

  • Target version changed from 7.4 (Backend) to 7.5
Actions #24

Updated by Benni Mack about 9 years ago

  • Target version deleted (7.5)
Actions #25

Updated by Wouter Wolters over 8 years ago

  • Status changed from Under Review to New

patch has been abandoned

Actions #27

Updated by Stephan Großberndt almost 7 years ago

removeBadHTML was marked as deprecated in TYPO3 v8.7 and removed in TYPO3 v9 with issue #15415

So the mentioned issue of preg_replace crashing in removeBadHTML could be addressed in TYPO3 v8.7 and could be maybe backported to 7.6 (not sure if security related?)

Actions #28

Updated by Oliver Hader over 5 years ago

  • Status changed from New to Closed

see https://docs.typo3.org/typo3cms/extensions/core/Changelog/8.2/Deprecation-15415-DeprecateRemoveBadHTML.html

removeBadHTML was a hardcoded and outdated collection of blacklisted literals to be removed in order to avoid XSS and similar - that's the reason why it has been dropped in TYPO3 v9 since it was incomplete. Besides encoding user submitted content using htmlspecialchars() (e.g. for attribute values) the HTMLParser could be used in order to purge disallowed attributes and tags in general (see https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Parsefunc.html)

Actions

Also available in: Atom PDF