ããã«ã¡ã¯ãXï¼ã¯ãã¹ï¼ã¤ããã¼ã·ã§ã³æ¬é¨ ã½ããã¦ã§ã¢ãã¶ã¤ã³ã»ã³ã¿ã¼ ã»ãã¥ãªãã£ã°ã«ã¼ãã®è¿ã§ãã
AWS WAF ã¯ç°¡åã« Web ã¢ããªã« WAF ã追å ã§ãããã¤å¤æ®µãä»ã® WAF 製åããå®ãããã好ã㪠AWS ãµã¼ãã¹ã®ä¸ã¤ã§ãããã㪠AWS WAF ã§ãããã°ããæ§ç¯ã»éç¨ãããããæåããç¥ã£ã¦ããã°ã»ã»ã»ã¨æã£ããã¨ãããã®ã§ 8ã¤ãç´¹ä»ãã¾ãã
AWS WAF ã®åºæ¬ã«ã¤ãã¦ã¯åãã£ã¦ããåæã§ãç¹ã«èª¬æã¯ãããã¾ãããã¾ã2023å¹´10æç¾å¨ã®ææ°ãã¼ã¸ã§ã³ã§ããããããããAWS WAF v2ãã対象ã¨ãã¦ãã¾ãã
- ãã®1: AWS ããã¼ã¸ãã«ã¼ã«ã®ããã£ãµã¤ãºå¶éãå³ãã
- ãã®2: ãã¡ã¤ã«ã¢ãããã¼ãã AWS ããã¼ã¸ãã«ã¼ã«ã® XSS ã«å¼ã£ããããã¨ããã
- ãã®3: ããã¼ã¸ãã«ã¼ã«ã«ã¯ãã¼ã¸ã§ã³ããã
- ãã®4: CloudWatch Logs ã®ãã°ã°ã«ã¼ãåã«æ±ºã¾ãããã
- ãã®5: 35åã®ãã°ã¹ããªã¼ã ã«åå²ããã
- ãã®6: ãã°ã« Cookie ãããã¼ãè¨é²ããã¦ãã¾ã
- ãã®7: ãã°åºåæ¡ä»¶ã® EXCLUDED_AS_COUNT ã¨ã¯ä½ã
- ãã®8: ã³ã³ã½ã¼ã«ã§ä½æããã«ã¼ã«ã JSON åºåãã㨠IaC ã§ã®æ¸ãæ¹ãããã
- ãããã«
ãã®1: AWS ããã¼ã¸ãã«ã¼ã«ã®ããã£ãµã¤ãºå¶éãå³ãã
AWS WAF ãå©ç¨ããéã« AWS ããã¼ã¸ãã«ã¼ã«ã¯ã¨ã¦ã便å©ã§ãããã®ä¸ã®ã³ã¢ã«ã¼ã«ã»ãã (CRS) ããã¼ã¸ãã«ã¼ã«ã°ã«ã¼ãã«ã¯ SizeRestrictions_BODY
ã¨ãããªã¯ã¨ã¹ãããã£ã®ãµã¤ãºãæ¤æ»ããã«ã¼ã«ãããã8 KB ãè¶
ããããã£ãæã¤ãªã¯ã¨ã¹ãããããã¯ãã¾ããããã£ãµã¤ãºã大ãããªã¯ã¨ã¹ããããã¡ã¤ã«ã¢ãããã¼ãã«ããã¦ã¯ 8 KB ãç°¡åã«è¶
ãã¦ãã¾ããã¨ãããã®ã§ãæ¬çªç°å¢ã«å°å
¥ããåã«æ³å®ãããµã¤ãºã®ãªã¯ã¨ã¹ãããããã¯ãããªãããã£ãããã¹ããå¿
è¦ã§ãã
â»ãã®ãããªã«ã¼ã«ãè¨å®ããã¦ããçç±ã¯ãAWS WAF ã¯ãªã¯ã¨ã¹ãããã£ã®æåã® 8 KB ããæ¤æ»ã§ããªãã¨ããå¶ç´ãããããã§ãããªã¯ã¨ã¹ãããã£ã® 8 KB 以éã®ä½ç½®ã«æ»ææååãå«ã¾ãã¦ãã¦ãæ¤æ»ã§ããªããããã³ã¢ã«ã¼ã«ã»ããã§ã¯ 8 KB ãè¶
ãããªã¯ã¨ã¹ããä¸å¾ã§ãããã¯ãããã¨ã§å¯¾å¿ãã¦ãã¾ãã
â»(2024/3/11追è¨)ãªã¯ã¨ã¹ãããã£ã®æ¤æ»ãµã¤ãºå¶éã 16 KBï¼64 KBã«å¼ãä¸ãå¯è½ï¼ã«å¢ãã¾ãããhttps://aws.amazon.com/about-aws/whats-new/2024/03/aws-waf-larger-body-inspections-regional-resources/
æ³å®ããæ£å½ãªãªã¯ã¨ã¹ãã 8 KB ãè¶
ãã¦ãã¾ãå ´åãã«ã¼ã«ã°ã«ã¼ãå
ã® SizeRestrictions_BODY
ã«ã¼ã«ã®ã¢ã¯ã·ã§ã³ããCountãã«ãªã¼ãã¼ã©ã¤ããããã¨ã§ãå®è³ªçã«é¤å¤ãããã¨ãã§ãã¾ãããã ãããã£ãµã¤ãºå¶éãå
¨ããªãã®ã¯å¿è¨±ãªãã®ã§ã次ã®ããã« WAF Web ACL ãä½ããã¨ãèãããã¾ãã
- ã³ã¢ã«ã¼ã«ã»ããããã¼ã¸ãã«ã¼ã«ã°ã«ã¼ãã§ã¯
SizeRestrictions_BODY
ããCountãã«ãªã¼ãã¼ã©ã¤ããã - é©åãªå¤ã§ããã£ãµã¤ãºå¶éãè¡ãç¬èªã«ã¼ã«ãä½æãã
- ãã®ãããªã«ã¼ã«ãè¤æ°ä½ãããªã¯ã¨ã¹ããã¹ã«å¿ãã¦ç°ãªãããã£ãµã¤ãºã®é¾å¤ãè¨å®ãããã¨ãå¯è½ã§ãï¼ä¾ãã°ãã¡ã¤ã«ã¢ãããã¼ããåãä»ãã URI ãã¹ã«å¯¾ãã¦ã¯ 100 KB ã«å¶éãããã以å¤ã® URI ãã¹ã«å¯¾ãã¦ã¯ 8 KB ã«å¶éãããªã©ï¼
- ããã£ãµã¤ãºå¶éã®é¾å¤ã 8 KB ãã大ããããå ´åãåè¿°ã®éãããããè¶ ããé¨åã®ãªã¯ã¨ã¹ãããã£ã®ä¸èº«ã¯ä»ã®ã«ã¼ã«ã§ãæ¤æ»ãããªããã¨ã«çæãã¦ãã ãã
ãªããre:Post ã®æ¬¡ã®æ稿ã§ã SizeRestrictions_BODY
ã§ãããã¯ãããå ´åã®å¯¾å¿æ¹æ³ãè¨è¼ããã¦ãã¾ããããã¼ã¸ãã«ã¼ã«ã«ä¸è´ããéã«è¿½å ãããã©ãã«ã¨ç¬èªã«ã¼ã«ãçµã¿åããã¦ãç¹å®ã® URI ãã¹ï¼=ãã¡ã¤ã«ã¢ãããã¼ããè¡ã URI ãã¹ï¼ã§ã¯ãªãå ´åã®ã¿ãããã¯ãçºåãããæ¹æ³ã§ãã
AWS WAF ã«ãã£ã¦ãããã¯ããã¦ãããã¡ã¤ã«ãã¢ãããã¼ãããã«ã¯ã©ãããã°ããã§ãã?
https://repost.aws/ja/knowledge-center/waf-upload-blocked-files
ãã®2: ãã¡ã¤ã«ã¢ãããã¼ãã AWS ããã¼ã¸ãã«ã¼ã«ã® XSS ã«å¼ã£ããããã¨ããã
Web ã¢ããªã«å¯¾ãã¦ãã¤ããªãã¡ã¤ã«ã®ã¢ãããã¼ããããæã«ãéæªãã³ã¢ã«ã¼ã«ã»ãã (CRS) ããã¼ã¸ãã«ã¼ã«ã°ã«ã¼ãã® CrossSiteScripting_BODY
ã«ã¼ã«ã«å¼ã£ããã£ã¦ãã¾ã£ããã¨ãããã¾ããããã®ã¨ãã®ãã°ã®ä¸é¨ã¯æ¬¡ã®éãã§ãããã¤ããªãã¼ã¿ã XSS ã®ã·ã°ããã£ã«ä¸è´ãã¦ãã¾ã£ãããã§ãã
"terminatingRuleMatchDetails": [ { "conditionType": "XSS", "location": "BODY", "matchedData": [ "<", "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" ] } ],
re:Post ã®æ¬¡ã®æ稿ã«ããã¨ããã¡ã¤ã«ã¢ãããã¼ãã§ã¯ CrossSiteScripting_BODY
以å¤ã«ã SQLi_BODY
ãWindowsShellCommands_BODY
ãGenericLFI_BODY
ãSizeRestrictions_BODY
ã«ã¼ã«ã«ãã£ã¦ãããã¯ãããå¯è½æ§ãããããã§ãã
AWS WAF ã«ãã£ã¦ãããã¯ããã¦ãããã¡ã¤ã«ãã¢ãããã¼ãããã«ã¯ã©ãããã°ããã§ãã?
https://repost.aws/ja/knowledge-center/waf-upload-blocked-files
æ稿ã§ã¯å¯¾å¿æ¹æ³ã¨ãã¦ãæååã¾ãã¯æ£è¦è¡¨ç¾ (regex) ä¸è´æ¡ä»¶ãè¨å®ãããã»ã¼ããªã¹ãã使ç¨ãã¦ããªã¯ã¨ã¹ãã許å¯ãã¾ããããç´¹ä»ããã¦ãã¾ããããã¼ã¸ãã«ã¼ã«ã«ä¸è´ããéã«è¿½å ãããã©ãã«ã¨ç¬èªã«ã¼ã«ãçµã¿åããã¦ããªã¯ã¨ã¹ãããã£ã«ç¹å®ã®æååï¼ãã¡ã¤ã«æ¡å¼µåãªã©ãæ³å®ãã¦ããã¨è§£éãã¾ããï¼ãå«ã¾ãã¦ããªãå ´åã®ã¿ãããã¯ãçºåããæ¹æ³ã§ããï¼æ³¨ï¼æ¥æ¬èªã®æ稿ã§ã¯ãªãããªã¯ã¨ã¹ããããã¼ããç¹å®ã®æååãæ¢ãã¨ããã¾ãããè±èªã®æ稿ã§ã¯ãªã¯ã¨ã¹ãããã£ããæ¢ãã¨æ¸ãã¦ããã¾ãããªã¯ã¨ã¹ãããã£ã®æ¹ããã£ãããã¦ãã¾ããï¼
ãããã¯ããã®1ãã® SizeRestrictions_BODY
ã®å ´åã¨åãããã«ãç¹å®ã® URI ãã¹ï¼=ãã¡ã¤ã«ã¢ãããã¼ããè¡ã URI ãã¹ï¼ã§ã¯ãªãå ´åã®ã¿ãããã¯ãçºåãããæ¹æ³ãåã£ã¦ãè¯ãããã§ãã
ãã®3: ããã¼ã¸ãã«ã¼ã«ã«ã¯ãã¼ã¸ã§ã³ããã
ããã¸ã¡ã³ãã³ã³ã½ã¼ã«ã§ããã¼ã¸ãã«ã¼ã«ã使ã£ã¦ãããããã«æ°ãä»ããã¨æãã®ã§ãããçè
㯠CDK 㧠Web ACL ãä½ã£ã¦ããã®ã§ãã£ã¨ç¥ãã¾ããã§ãããããã¼ã¸ãã«ã¼ã«ã«ã¯ãã¼ã¸ã§ã³ãåå¨ãã¾ãã
ï¼AWS ããã¼ã¸ãã«ã¼ã«ã®ãã¡ãIP ã¬ãã¥ãã¼ã·ã§ã³ãBot Controlãã¢ã«ã¦ã³ãä¹ã£åãé²æ¢ã®ã«ã¼ã«ã°ã«ã¼ããã«ã¯ãã¼ã¸ã§ã³ãåå¨ãã¾ããããã¼ã¸ã§ã³ã«é¢ããããæ¥ããããé »ç¹ã«ã«ã¼ã«ãæ´æ°ãããããã§ããããï¼
ãã¼ã¸ã§ã³ãç¹ã«æå®ããªãå ´åããã®ããã¼ã¸ãã«ã¼ã«ãããã©ã«ãã¨è¨å®ãããã¼ã¸ã§ã³ãå©ç¨ãããã«ã¼ã«ãããã¤ãã¼ãããã©ã«ããã¼ã¸ã§ã³ãå¤æ´ããã¨æ§ç¯ãã Web ACL ã§ãèªåçã«æ°ãããã¼ã¸ã§ã³ã«æ´æ°ããã¾ããèªåçã«æ´æ°ããããã¨ãé¿ãããå ´åã¯ããéçãã¼ã¸ã§ã³ããæ示çã«æå®ãã¾ãããã ããã®å ´åãããç·æ¥æã®å¿ é ã®æ´æ°ãããããå¯è½æ§ãããããã§ããã¾ããã¼ã¸ã§ã³ã®æå¹æéãåããã¨ã次ã®ãããªæ±ãã«ãªãããã§ãã
- AWS ããã¼ã¸ãã«ã¼ã«ã«ã¼ã«ã°ã«ã¼ãã®å ´åãAWS WAF ã¯ãæå¹æéåãã®ãã¼ã¸ã§ã³ã使ç¨ãã¦ããã¦ã§ã ACL ããã«ã¼ã«ã°ã«ã¼ãã®ããã©ã«ããã¼ã¸ã§ã³ã«ç§»åãã¾ãã
- AWS Marketplace ã«ã¼ã«ã°ã«ã¼ãã®å ´åããããã¤ãã¼ã¯æå¹æéã®å¦çæ¹æ³ã決å®ãã¾ãã詳細ã«ã¤ãã¦ã¯ãããã¼ã¸ãã«ã¼ã«ã°ã«ã¼ããããã¤ãã¼ã«åãåããã¦ãã ããã
ããã¼ã¸ãã«ã¼ã«ã«ã¯ SNS ãããã¯ãç¨æããã¦ããå ´åãããããµãã¹ã¯ã©ã¤ããããã¨ã§ãã¼ã¸ã§ã³ãå«ããã«ã¼ã«ã®æ´æ°æ å ±ãåãåããã¨ãã§ãã¾ããç¹ã«éçãã¼ã¸ã§ã³ã使ç¨ããå ´åã¯ã«ã¼ã«ãã¼ã¸ã§ã³ãæåæ´æ°ãããã¨ã«ãªãã®ã§ãSNS ãããã¯ããµãã¹ã¯ã©ã¤ããã¦ããã¨è¯ãã§ãããã
ãã®4: CloudWatch Logs ã®ãã°ã°ã«ã¼ãåã«æ±ºã¾ãããã
AWS WAF ãå©ç¨ããå ´åã¯ãã°ããã²åã£ã¦ããããã¨ããã§ãããCloudWatch Logs ã«åºåããå ´åããã°ã°ã«ã¼ãå㯠aws-waf-logs-
ã§å§ã¾ãå¿
è¦ãããã¾ãã
https://docs.aws.amazon.com/ja_jp/waf/latest/developerguide/logging-cw-logs.html#logging-cw-logs-naming
ããã¸ã¡ã³ãã³ã³ã½ã¼ã«ã§ãã°ã°ã«ã¼ããæå®ããå ´åã¯ç»é¢ã«ãã®æ¡ä»¶ãæ¸ãã¦ããã¾ããã aws-waf-logs-
ã§å§ã¾ããã°ã°ã«ã¼ã以å¤ã¯é¸æè¢ã«è¡¨ç¤ºãããªãã®ã§ã¾ã åãããããã§ãã
ããã CloudFormation ï¼ãã¡ãã CDK ãï¼ãå©ç¨ããå ´åãaws-waf-logs-
ã§å§ã¾ããã°ã°ã«ã¼ã以å¤ã Web ACL ã«é¢é£ä»ããããã¨ããã¨ããããã¤æã«æ¬¡ã®ãããªã¨ã©ã¼ã«ãªãã¾ãããARN ãæå¹ã§ãªããã¨ããã¨ã©ã¼ã¡ãã»ã¼ã¸ã§ã¯ä½ããããªãã®ãå
¨ãåããããã©ããããããã¨ãããã®ã¯èªåã ãã§ã¯ãªãã¯ãã§ãã
Resource handler returned message: "Error reason: The ARN isn't valid. A valid ARN begins with arn: and includes other information separated by colons or slashes., field: LOG_DESTINATION, parameter: arn:aws:logs:ap-northeast-1:111122223333:log-group:waf-logs-xxxxx
ã¡ãªã¿ã«ãã°ã®åºåå
ã S3 ãã±ããã®å ´åãããã±ããå㯠aws-waf-logs-
ã§å§ã¾ãå¿
è¦ãããã¾ãã
https://docs.aws.amazon.com/ja_jp/waf/latest/developerguide/logging-s3.html#logging-s3-naming
ãã®5: 35åã®ãã°ã¹ããªã¼ã ã«åå²ããã
CloudWatch Logs ã«ãã°ãåºåããã¨ã35åã®ãã°ã¹ããªã¼ã ã«åå²ããããã®æ°ãæ¸ãããã¨ã¯ã§ãã¾ãããåºåã®ã¹ã«ã¼ããããé«ããããã®ããã§ãã
è¿ãæå»ã§çºçãããã°ã¡ãã»ã¼ã¸ã§ããè¤æ°ã®ãã°ã¹ããªã¼ã ã«åæ£ãã¦åºåãããããããã°ã°ã«ã¼ãããç¹å®ã®ãã°ãæ¢ãã®ã¯é£ããã§ãããã°ã¹ããªã¼ã ã横æãã¦æç³»åã«ãã°ãè¦ãããç¹å®ã®ãã°ãæ¢ãããå ´å㯠CloudWatch Logs Insights ãå©ç¨ããã®ã便å©ã§ãã以ä¸ã®å ¬å¼ããã°ã re:Post æ稿ãåèã«ãªãã¾ãã
Amazon CloudWatch Logs ã«ãã AWS WAF ãã°ã®åæ
https://aws.amazon.com/jp/blogs/news/analyzing-aws-waf-logs-in-amazon-cloudwatch-logs/
CloudWatch ã¾ã㯠Amazon S3 ã«ä¿åããã¦ãã AWS WAF ãã°ãåæãããªãã·ã§ã³ã¯ä½ã§ãã?
https://repost.aws/ja/knowledge-center/waf-analyze-logs-stored-cloudwatch-s3
ãã®6: ãã°ã« Cookie ãããã¼ãè¨é²ããã¦ãã¾ã
WAF Web ACL ã®ãã°ãåºåããã¨ãhttpRequest.headers
ãã£ã¼ã«ãã«ãªã¯ã¨ã¹ããããã¼ãè¨é²ããã¾ããã¤ã¾ããã¯ã©ã¤ã¢ã³ããéä¿¡ãã Cookie ãè¨é²ããã¦ãã¾ãã¾ãã
ï¼ã¹ã¯ãªã¼ã³ãã£ããã£ã®å¤ã¯ããã¼ã§ãï¼
ä¾ãã°åæã®ããã«ãã°ãåºåããããå
±æãããããã¨æå¹ãªã»ãã·ã§ã³ ID ãªã©ã»ã³ã·ãã£ããªæ
å ±ãæ¼ãããããªã¹ã¯ãããã¾ãã
ãã®åé¡ã¸ã®å¯¾å¿ã¨ãã¦ããã°åºåæã«ç¹å®ãã£ã¼ã«ãããã¹ãã³ã°ãããã¨ãå¯è½ã§ããä¾ãã° cookie ãããã¼ããã¹ãã³ã°ããã«ã¯æ¬¡ã®ããã«è¨å®ãã¾ãã
ãã®ããã«è¨å®ããã¨ãåºåããããã°ã® cookie ãããã¼ã¯ REDACTED
ã¨ããæååã«ç½®ãæãããã¾ãã
ãã®7: ãã°åºåæ¡ä»¶ã® EXCLUDED_AS_COUNT ã¨ã¯ä½ã
ãã°ãåºåããå ´åãã¢ã¯ã·ã§ã³ãç¹å®ã®æ¡ä»¶ã«è©²å½ããå ´åã®ã¿åºåããããã«è¨å®ã§ãã¾ãããªã¯ã¨ã¹ãã許å¯ãããå ´åã®ãã°ãå ¨ã¦è¨é²ããã¨éãå¤ããªã£ã¦ãã¾ãã®ã§ãããããã¯ãæã¨ãã«ã¦ã³ããæã®ã¿åºåããããã¨ãããã¾ãã
ã«ã¦ã³ãæã®æ¡ä»¶ã¯ãå®ã¯ COUNT
㨠EXCLUDED_AS_COUNT
ã®2種é¡ãããã¾ããåºæ¬çã«ã¯ COUNT
æ±ãã¨èãã¦è¯ãã§ããã EXCLUDED_AS_COUNT
ã¨ãã¦æ±ãããã±ã¼ã¹ã2ã¤ã以ä¸ã®ããã°ã§èª¬æããã¦ãã¾ãã
AWS WAF ã®ãã°åæã«é¢ããèæ
®äºé
https://aws.amazon.com/jp/blogs/news/aws-waf-log-analysis-considerations/
- ããã¼ã¸ãã«ã¼ã«ã°ã«ã¼ã㧠âSet all rule actions to countâ 㧠Count ã«è¨å®ããå ´å
- ããã¼ã¸ãã«ã¼ã«ã°ã«ã¼ãã§åå¥ã®ã«ã¼ã«ã Count ã«è¨å®ããå ´å
ãã ãä¸ã® AWS ã®ããã°ã¯æ å ±ãå¤ããç¾å¨åå¥ã®ã«ã¼ã«ã Count ã«è¨å®ããå ´åã®åãã¯å°ã ç°ãªãããã§ãï¼åç §ï¼ãç°¡åã«ã¾ã¨ããã¨ã以ä¸ã®ããã«ãªãã¨ç解ãã¦ãã¾ãï¼
- 2022 å¹´ 10 æ 27 æ¥ããåã«ã
- WAF ã«ã¼ã«ã® JSON ã§ã¯
ExcludedRules
ãå©ç¨ã§ããããã«å«ããåå¥ã«ã¼ã«ã¯EXCLUDED_AS_COUNT
æ±ãã«ãªã - ããã¸ã¡ã³ãã³ã³ã½ã¼ã«ã§åå¥ã«ã¼ã«ã Count ã«è¨å®ããã¨ã
EXCLUDED_AS_COUNT
æ±ãã«ãªã
- WAF ã«ã¼ã«ã® JSON ã§ã¯
- 2022 å¹´ 10 æ 27 æ¥ä»¥éã¯ã
- WAF ã«ã¼ã«ã® JSON ã§
ExcludedRules
ã«å«ããåå¥ã«ã¼ã«ã¯å¤ãããEXCLUDED_AS_COUNT
æ±ãã«ãªã - WAF ã«ã¼ã«ã® JSON ã§
RuleActionOverrides
ãæ°ããå©ç¨ã§ãããªã¼ãã¼ã©ã¤ãå ãã«ã¦ã³ãã«ããå ´åã¯COUNT
æ±ãã«ãªã - ããã¸ã¡ã³ãã³ã³ã½ã¼ã«ã§åå¥ã«ã¼ã«ã Count ã«è¨å®ï¼éå»ã«ä½æããã«ã¼ã«ã®ç·¨éãå«ãã¦ï¼ããã¨ã
COUNT
æ±ãã«å¤ãã
- WAF ã«ã¼ã«ã® JSON ã§
ãã®åããæèãã¦ãã°åºåæ¡ä»¶ãä½æããã¨è¯ãã¨æãã¾ãã
ãã®8: ã³ã³ã½ã¼ã«ã§ä½æããã«ã¼ã«ã JSON åºåãã㨠IaC ã§ã®æ¸ãæ¹ãããã
CloudFormation ããã㯠CDK ã§è¤éãªæ¡ä»¶ã® Web ACL ãä½æããå ´åãæ¸ãæ¹ãåãããã«å°ããã¨ãããã¾ãã
ä¾ãã°ãURIãã¹ã /file/upload
以å¤ã¸ã®ãªã¯ã¨ã¹ãã§ããã£ãµã¤ãºã 100 KB 以ä¸ã®å ´åã«ãããã¯ãããã«ã¼ã«ã¯ãCDK ã ã¨ãããªæãã§æ¸ããã¨ã«ãªãã¾ããï¼ã«ã¼ã«é¨åã®ã¿ï¼
{ name: "SizeConstraint", priority: 10, statement: { andStatement: { statements: [ { notStatement: { statement: { byteMatchStatement: { searchString: "/file/upload", fieldToMatch: { uriPath: {}, }, textTransformations: [ { priority: 0, type: "NONE", }, ], positionalConstraint: "EXACTLY", }, }, }, }, { sizeConstraintStatement: { fieldToMatch: { body: { oversizeHandling: "CONTINUE", }, }, comparisonOperator: "GE", size: 100 * 1000, textTransformations: [ { priority: 0, type: "NONE", }, ], }, }, ], }, }, action: { block: {} }, visibilityConfig: { sampledRequestsEnabled: true, cloudWatchMetricsEnabled: true, metricName: "SizeConstraint", }, },
ããããã³ããªãã§æ£ããæ¸ããæ°ããã¾ãããä¸æ¹ã§ããã¸ã¡ã³ãã³ã³ã½ã¼ã«ã§ã«ã¼ã«ãä½æããã°ãç»é¢ã®èª¬æã«å¾ã£ã¦å²ã¨åãããããä½æã§ãã¾ãã
ãã㧠IaC 㧠WAF ã®ã«ã¼ã«ãä½ãå ´åããã¾ãã¯ããã¸ã¡ã³ãã³ã³ã½ã¼ã«ã§è©¦ãã«ä½æãã¦ã¿ã¦ãç»é¢ã§ãã«ã¼ã« JSON ã¨ãã£ã¿ãã«åãæ¿ãã¾ããããJSON ã§ã®ã«ã¼ã«ã®æ¸ãæ¹ã表示ãã¦ããã¾ãããããã³ãã¼ã㦠IaC ã§å©ç¨ããã¨è¯ãã§ããããï¼CDK ã«ä½¿ãå ´åã¯ããããã£åã®é æåã大æåããå°æåã«å¤æããå¿ è¦ãããã¾ãããèªåã§æ¸ãããã¯ãã£ã¨æ¥½ã§ããï¼
ã¡ãªã¿ã«ã«ã¼ã« JSON ã¨ãã£ã¿ç»é¢ã®èª¬æã«ãããéããJSON ã使ãã°ãã¸ã¥ã¢ã«ã¨ãã£ã¿ã§ã¯ãµãã¼ãããã¦ããªããããªãæ·±ãé層ã®æ¡ä»¶ãæã¤ã«ã¼ã«ãä½ããã¨ãã§ãã¾ãã以ä¸ã® re:Post æ稿ãåèã«ãªãã¾ãã
è¤éãªã«ã¹ã¿ã AWS WAF JSON ã«ã¼ã«ãä½æããæ¹æ³ãæãã¦ãã ããã
https://repost.aws/ja/knowledge-center/waf-create-complex-custom-rules
ãããã«
ãç´¹ä»ããå 容ã¯ããããå ¬å¼ããã¥ã¡ã³ããããã°ã«æ¸ãã¦ãããã¨ãªã®ã§ãããWAF ã使ãå§ããæã¯æ©ãæ§æãããæ°æã¡ãå èµ°ã£ã¦ãªããªãç¶²ç¾ çã«ãã§ãã¯ã¯ã§ãã¾ããããä»æ¯ãè¿ãã¨æåã«ç¥ã£ã¦ããããã£ãã¨æãããã¨ãã¾ã¨ãã¦ã¿ã¾ããã誰ãã®åèã«ãªãã°å¬ããã§ãã
è¨äºã®ä¸ã«æ²è¼ãããªã³ã¯ã§ç¹ã«ããããã®ãã®ãåæ²ãã¦ããã¾ãã
- ã³ã¢ã«ã¼ã«ã»ãã (CRS) ããã¼ã¸ãã«ã¼ã«ã°ã«ã¼ã
- https://docs.aws.amazon.com/ja_jp/waf/latest/developerguide/aws-managed-rule-groups-baseline.html#aws-managed-rule-groups-baseline-crs
- ï¼ã©ã®ãããªã«ã¼ã«ã§æ¤æ»ãè¡ãã®ããå©ç¨åã«ä¸éãææ¡ãã¦ããã¾ãããï¼
- AWS WAF ã«ãã£ã¦ãããã¯ããã¦ãããã¡ã¤ã«ãã¢ãããã¼ãããã«ã¯ã©ãããã°ããã§ãã?
- Amazon CloudWatch Logs ã«ãã AWS WAF ãã°ã®åæ
- CloudWatch ã¾ã㯠Amazon S3 ã«ä¿åããã¦ãã AWS WAF ãã°ãåæãããªãã·ã§ã³ã¯ä½ã§ãã?
- ã«ã¼ã«ã°ã«ã¼ãå ã®ã¢ã¯ã·ã§ã³ãªã¼ãã¼ã©ã¤ã
- è¤éãªã«ã¹ã¿ã AWS WAF JSON ã«ã¼ã«ãä½æããæ¹æ³ãæãã¦ãã ããã
以ä¸ã¯ããã®è¨äºã§ã¯è§¦ãã¾ããã§ãããåèã¨ãªã re:Post ã®æ稿ã§ãã
- AWS WAF ã«ã¼ã«ã§ãããã¯ããã¦ãããã¡ã¤ã«ã®ã¢ãããã¼ãããã«ã¼ã«ãé¤å¤ããã«æ示çã«è¨±å¯ããã«ã¯ãã©ãããã°ããã§ããï¼
- AWS WAF ã® HTTP ãªã¯ã¨ã¹ãã® XSS ã¾ã㯠SQLi æ¤æ»ããç¹å®ã® URI ãé¤å¤ããæ¹æ³ãæãã¦ãã ããã
- AWS WAF ãå©ç¨ã㦠DDoS æ»æãç·©åããã«ã¯ã©ãããã°ããã§ãã?
ç§ãã¡ã¯ä¸ç·ã«åãã¦ããã仲éãåéãã¦ãã¾ãï¼
é»éç·ç ä¸éæ¡ç¨ãã¼ã¸ é»éç·ç æ°åæ¡ç¨ãã¼ã¸å·çï¼@kou.kinyoãã¬ãã¥ã¼ï¼å¯ºå±± è¼ (@terayama.akira)
ï¼Shodoã§å·çããã¾ããï¼