Answer: B
Option A is incorrect because AWS Trusted Advisor assists on how you can improve the security on your AWS account, but does not protect against threats such as SQL injection and cross-site scripting mentioned in the question.
Option B is CORRECT because AWS WAF allows you to create rules that can help to protect against common web exploits like SQL injection and cross-site scripting.
Option C is incorrect because AWS Inspector can be used to scan EC2 Instances for vulnerabilities but not protect against threats such as SQL injection and cross-site scripting mentioned in the question.
Option D is incorrect because AWS Config can be used to check configuration changes on your AWS Account but not protect against threats.
For more information on AWS WAF, please visit the following URL:
https://aws.amazon.com/waf/details/