Code

Opened 6 years ago

Closed 6 years ago

#7336 closed (invalid)

DoS on malformed markdown input

Reported by: anders@… Owned by: nobody
Component: Template system Version: master
Severity: Keywords: markdown
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

When using the markdown template filter to format text, input with malformed markdown like the following will cause the entire django server to hang, consuming 100% CPU:

 [First Link[ (http://www.example.com/file.html) and [Second Blah Link](http://www.amazon.com/Chinese-Business-Etiquette-Protocol-Republic/dp/0446673870/ref=sr_1_1?ie=UTF8&s=books&qid=1211092179&sr=8-1) [Third Link](http://www.example.com/?blah=blah&blah-blah=blah-blah)

Note the "[First Link[" typo. That seems to send the markdown parser into some kind of loop, making it do exponentially more work for each link that appears in the text after that point. There's something more to it that that amazon url triggers. Simpler urls in succeeding links don't cause it to behave quite as badly and I haven't had time to make a simpler test case.

This was first noticed on a production site being served with mod_wsgi (hitting the url that served up the offending content would make the entire site unresponsive until the apache process was manually killed) and verified in a standalone development environment.

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by jacob

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

Sounds like this a bug with python-markdown, not Django; I'd file this bug there.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.