Receive (and send) XML via POST with ASP.NET

后端 未结 3 855
无人及你
无人及你 2021-01-03 05:55

I have to set up an XML \"web service\" that receives a POST where the \'Content-type header will specify “text/xml”.\'

What is the simplest way to get the XML into

3条回答
  •  自闭症患者
    2021-01-03 06:44

    I want to apologize in advance for not answering your question here, but I want to give a little warning. Perhaps it is already something you're taking into account, but if you don't take the appropriate counter measures, your system can be easily shut down using a denial of service attack, when processing XML from an unknown source (both over HTTP and HTTPS).

    There is a technique called XML Entity Expansion attacks. Look for instance at this innocent looking peace of XML that will bring your server to its knees when it tries to process it:

     
     
     
     
     
     
     
     
     
     
     
     
    ]> 
    &m;
    

    This little XML document of less than 500 bytes will make your server try to allocate at least 160 GB of memory.

    You can protect yourself against this by validating the incoming XML (with an DTD) before processing it.

    You can read more information about this attack, here.

    Good luck.

提交回复
热议问题