「A potentially dangerous Request.Form value was detected from the client」

真 川崎 196 Reputation points
2023-10-18T06:49:47.46+00:00

I am building a web server in Azure with a configuration of CDN - WAF - WebApps.

This is a .Net Framework web application.

Because requestValidationMode="4.0"

"A potentially dangerous Request.Form value was detected from the client"

This error blocks invalid Form data.

I have no problem with you blocking me,

I would like to block it with Firewall before it reaches WebApps.

The reason is to reduce the load by not having the server process unnecessary requests.

Application Gateway WAF policy custom rules

"A potentially dangerous Request.Form value was detected from the client"

Is it possible to set a block similar to the blocking condition?

Azure Web Application Firewall
{count} votes

Accepted answer
  1. KapilAnanth-MSFT 45,111 Reputation points Microsoft Employee
    2023-10-23T08:18:01.36+00:00

    @真 川崎

    Welcome to the Microsoft Q&A Platform. Thank you for reaching out & I hope you are doing well.

    You were loggin the error "A potentially dangerous Request.Form value was detected from the client" within your application.

    And you would like to know the best practices for mitigating this.

    Since the logs are from the application, the Platform does not much visibility onto it.

    The Manged Rules should detect the issue if this can be remediated via Platform.

    Here is a list of Managed Rules for OWASP 3.0 : https://video2.skills-academy.com/en-us/azure/web-application-firewall/ag/application-gateway-crs-rulegroups-rules?tabs=drs21#owasp-crs-30

    • If the WAF is in Detetcion mode, I suggested you to enable prevention mode.
    • In case the WAF is in prevention mode and no rule is triggered, then you must use Custom Rules
    • You must tune your WAF according to your application/use case/requirement
      i.e., please check the application as to why this error is generated and tailor the Custom Rules to block such requests.
    • Refer : Tune your WAF

    One such example is,

    • You can consider "Match variable"
      • And within it, you can use "RequestBody"
        • User's image
    • And set the "Operator" as "Contains" and specify the string value which you would like to block.
    • And set "Action" as Block or Log

    Kindly let us know if this helps or you need further assistance on this issue.

    Thanks,

    Kapil


    Please don’t forget to close the thread by clicking "Accept the answer" wherever the information provided helps you, as this can be beneficial to other community members.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.