Plugin Directory

Changeset 3775297


Ignore:
Timestamp:
10/30/2026 01:01:23 PM (25 hours ago)
Author:
moustafaiub
Message:

Tagging Beta

Location:
iubenda-cookie-law-solution/tags/beta
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • iubenda-cookie-law-solution/tags/beta/iubenda-cookie-class/simple_html_dom.php

    r3773736 r3775297  
    16741674                        $rand = md5( uniqid( (string) mt_rand(), true ) );
    16751675                }
    1676                 $this->noise_prefix = '___noise___' . $rand . '_';
     1676                // Trailing space is deliberate: an attribute name stops at a space, so a
     1677                // key can never be one and noise can never be restored into that position.
     1678                $this->noise_prefix = '___noise___' . $rand . ' ';
    16771679                $this->nodes = array();
    16781680                $this->lowercase = $lowercase;
    … …  
    22802282                $prefix     = $this->noise_prefix;
    22812283                $prefix_len = strlen($prefix);
    2282 
    2283                 while (($pos = strpos($text, $prefix)) !== false) {
     2284                $offset     = 0;
     2285
     2286                // The search offset only ever moves forward, so the loop is O(n) in the
     2287                // length of $text and can never rescan a region it has already resolved.
     2288                // It is the structural guarantee against the DoS: no branch below re-emits
     2289                // the prefix, and every branch advances $offset past the token it saw.
     2290                while (($pos = strpos($text, $prefix, $offset)) !== false) {
    22842291                        // A valid placeholder is the per-parse prefix followed by a 5-char
    22852292                        // numeric key. The prefix carries a random, per-parse component, so
    … …  
    23152322                                        . $restored
    23162323                                        . substr($text, $pos + $prefix_len + 5);
     2324
     2325                                        // Resume the search at the start of the just-restored body so a
     2326                                        // placeholder nested inside it (e.g. a comment stashed inside a
     2327                                        // <script> body) is still expanded. The noise table is finite
     2328                                        // and each pass resolves one entry, so this still terminates.
     2329                                        $offset = $pos;
    23172330                                } else {
    2318                                         // Unknown key: consume the whole token so the loop always
    2319                                         // advances and never re-emits the prefix. Re-emitting it let
    2320                                         // strpos() match it again on the next pass and spin forever
    2321                                         // while growing the string (an unauthenticated DoS).
    2322                                         $text = substr($text, 0, $pos)
    2323                                         . substr($text, $pos + $prefix_len + 5);
     2331                                        // Unknown key: never re-emit the prefix (that is what let the
     2332                                        // old guard spin forever). Leave the original bytes in place and
     2333                                        // step the offset past this occurrence, so content is preserved
     2334                                        // rather than silently deleted and the loop still advances.
     2335                                        $offset = $pos + $prefix_len + 5;
    23242336                                }
    23252337                        } else {
    2326                                 // Truncated token at the end of the string: drop just the prefix
    2327                                 // occurrence so the loop terminates.
    2328                                 $text = substr($text, 0, $pos)
    2329                                 . substr($text, $pos + $prefix_len);
     2338                                // Truncated token at the end of the string: leave the bytes and
     2339                                // step past the prefix so the loop terminates without eating them.
     2340                                $offset = $pos + $prefix_len;
    23302341                        }
    23312342                }
  • iubenda-cookie-law-solution/tags/beta/readme.txt

    r3773736 r3775297  
    271271* Improved: Cookie-block markers are now stripped from visitor comments, so comment content is never re-processed by the Native Blocking parser
    272272* Fixed: A malformed cookie-block marker could stall page rendering
    273 * Credit: Reported by Jakub Herman
     273* Credit: Reported independently by Jakub Herman (via WPScan), via Wordfence, and by Dthangws (via Patchstack)
    274274
    275275= 3.13.6 =
Note: See TracChangeset for help on using the changeset viewer.