API ã§ã®èªèšŒ¶
å€ãã® API ã§ã¯ã次ã®ã¹ãããã¯èªèšŒã®ã»ãã ã¢ããã§ããçµå±ã®ãšãããæ£åžžã«èªèšŒã§ããªããã°ãMayhem ã¯éåžžã«è¡šé¢çãªåé¡ãããã¹ãã§ããŸããããã¡ã¶ãŒã«ã¿ãŒã²ãã API ã§èªèšŒããæ¹æ³ãæ瀺ãããšãããå€ãã®ãšã³ããã€ã³ããå®è¡ããã«ãã¬ããžãæ倧åã§ããŸãã
Mayhem ã¯ããã©ã«ãã§ããŒã·ãã¯èªèšŒãããããŒããŒã¹ã®èªèšŒ (ãã¢ã©ãŒ ããŒã¯ã³ãªã©)ãCookie ããŒã¹ã®èªèšŒããµããŒãããŠããŸãããããã§ã¯ååã§ã¯ãªãå Žåãæžãæããã©ã°ã€ã³ ã·ã¹ãã ã«ãã£ãŠãåºæã®èªèšŒã¹ããŒã ã«å¿ èŠãªä»»æã®ä»çµã¿ãå®è£ ãããšãã匷åãªãªãã·ã§ã³ããããŸãããããã®ãªãã·ã§ã³ã«ã€ããŠã¯ãäžã®ã»ã¯ã·ã§ã³ã§èª¬æããŸããããããŸããå ±éäºé ã«ã€ããŠèª¬æããŸãã
èªèšŒæ å ±ã®æå³ããªãç¡å¹å¶
ãã¡ãžã³ã°ã«äœ¿çšããèªèšŒæ
å ±ããã°ã¢ãŠã ãšã³ããã€ã³ãã«ãã£ãŠç¡å¹åãããå¯èœæ§ãããå Žåãã»ãŒç¢ºå®ã«ã次ã®ããã« mapi run
ã« --ignore-endpoint
ãæå®ããŠããã¡ã¶ãŒã該åœãšã³ããã€ã³ãã«ãªã¯ãšã¹ããçºè¡ããªãããã«ããå¿
èŠãããã§ãããã
mapi run [...] --ignore-endpoint "/api/logout"
Info
ãã®ãã©ã°ãããã¡ãºå¯Ÿè±¡ãéžæããããã®ãã®ä»ã®ä»çµã¿ã«ã€ããŠã¯ããéžæçã«ãŒã ãã¹ãããåç §ããŠãã ããã
ããŒã·ãã¯èªèšŒ¶
ããŒã·ã㯠ã¢ã¯ã»ã¹èªèšŒã¯ãWeb ãªãœãŒã¹ã«å¯ŸããŠã¢ã¯ã»ã¹å¶åŸ¡ãé©çšããããã®ã·ã³ãã«ãªæè¡ã§ãããã»ãšãã©ã® Web ãµãŒããŒã§ãµããŒããããŠããŸããmapi run
ã䜿çšããŠã¿ãŒã²ããããã¡ãžã³ã°ããéãããŒã·ãã¯èªèšŒæ
å ±ãæå®ããã«ã¯ã次ã®ã³ãã³ãã©ã€ã³ ãªãã·ã§ã³
mapi run --basic-auth "username:password" <target> <duration> <specification>
ãŸãã¯ç°å¢å€æ°ã䜿çšããŸãã
export MAPI_BASIC_AUTH="username:password"
mapi run <target> <duration> <spec>
ããŒã·ãã¯èªèšŒã¯ãããèªäœã¯ãŠãŒã¶ãŒåããã³ãã¹ã¯ãŒããä¿è·ããªãããšã«æ³šæããŠãã ãããäŒéæã« base64 ãšã³ã³ãŒãã£ã³ã°ãããã ãã§ãæå·åãããã·ã¥åã¯è¡ãããŸãããèªèšŒæ å ±ãä¿è·ãããããããŒã·ãã¯èªèšŒãš HTTPS ãçµã¿åãããŠäœ¿çšããããä¿¡é Œããããããã¯ãŒã¯ã§äœ¿çšããã¹ãã§ãã
ããããŒèªèšŒ (ãã¢ã©ãŒ ããŒã¯ã³ãªã©)¶
ãã¢ã©ãŒèªèšŒ (ããŒã¯ã³èªèšŒãšãåŒã°ããŸã) ã¯ããã¢ã©ãŒ ããŒã¯ã³ãšåŒã°ããã»ãã¥ãªãã£ããŒã¯ã³ãå©çšãã HTTP èªèšŒã¹ããŒã ã§ããã¯ã©ã€ã¢ã³ãã¯ãä¿è·ããããªãœãŒã¹ãžã®ãªã¯ãšã¹ããè¡ãéãAuthorization ããããŒã«ããŒã¯ã³ãå«ããŠéä¿¡ããå¿ èŠããããŸãã
mapi run --header-auth "Authorization: bearer <token>" <target> <duration> <spec>
Mayhem ã§ã¯ãåãä»çµã¿ãä»»æã®ããããŒããŒã¹ã®èªèšŒã«æ±çšçã«å©çšã§ããŸããäŸ:
mapi run --header-auth "X-Custom: auth <token>" <target> <duration> <spec>
ç°å¢å€æ°ã䜿çšããŠããããŒã«æž¡ãããšãã§ããŸãã
export MAPI_HEADER_AUTH="Authorization: bearer <token>"
mapi run <target> <duration> <spec>
èªèšŒããããŒã¯ãããèªäœã¯ããŒã¯ã³ãä¿è·ããªãããšã«æ³šæããŠãã ããããµãŒããŒã«ããŒã¯ã³ãéä¿¡ããåã«æå·åãããã·ã¥åã¯è¡ãããŸãããããŒã·ãã¯èªèšŒã®å Žåãšåæ§ã«ãèªèšŒæ å ±ãä¿è·ãããããããããŒèªèšŒãš HTTPS ãçµã¿åãããŠäœ¿çšããããä¿¡é Œããããããã¯ãŒã¯ã§äœ¿çšããã¹ãã§ãã
Info
èªèšŒæ
å ±ãå«ãŸãªãã«ã¹ã¿ã ããããŒãæå®ããã«ã¯ã--header-auth
ã§ã¯ãªã --header
ã䜿çšããŸããMayhem ã¯ãåé¡ãæ¢çŽ¢ããéãæœåšçãªæ©å¯ããŒã¿ãç·šéããéã--header-auth
ãç¹å¥ã«æ±ããŸãã
Cookie èªèšŒ¶
Cookie èªèšŒã¯ãHTTP Cookie ã䜿çšããŠã¯ã©ã€ã¢ã³ã ãªã¯ãšã¹ããèªèšŒããã»ãã·ã§ã³æ
å ±ãç¶æããŸããäžè¬çã«ãCookie ã¯ãã°ã€ã³ãæåããåŸã«ãµãŒããŒããè¿ãããåŸç¶ã®ãªã¯ãšã¹ãã§ã¯ã©ã€ã¢ã³ãããéä¿¡ãããŸããmapi run
ã䜿çšããŠã¿ãŒã²ããããã¡ãžã³ã°ããéãCookie ãæå®ããã«ã¯ã次ã®ã³ãã³ãã©ã€ã³ ãªãã·ã§ã³
mapi run --cookie-auth "PHPSESSID=abe67cd" <target> <duration> <spec>
ãŸãã¯ç°å¢å€æ°ã䜿çšããŸãã
export MAPI_COOKIE_AUTH="PHPSESSID=abe67cd"
mapi run <target> <duration> <spec>
Cookie ã¯ãµãŒããŒã«éä¿¡ãããåã«æå·åãŸãã¯ããã·ã¥åãããªãããšã«æ³šæããŠãã ãããããŒã·ãã¯èªèšŒããã³ããããŒèªèšŒã®å Žåãšåæ§ã«ãèªèšŒæ å ±ãä¿è·ããããCookie èªèšŒãš HTTPS ãçµã¿åãããŠäœ¿çšããããä¿¡é Œããããããã¯ãŒã¯ã§äœ¿çšããã¹ãã§ãã
æžãæããã©ã°ã€ã³ã䜿çšããèªèšŒ¶
äžèšã®æ¹æ³ã§ã¯å¯Ÿå¿ã§ããªãå Žå (API ãã¹ã ãžã§ãã®éçšã§åçã«èªèšŒãããå Žåãªã©)ãæžãæããã©ã°ã€ã³ ã·ã¹ãã ã䜿çšããŠç¬èªã«ã³ãŒãã£ã³ã°ãè¡ãããšãã§ããŸãã
æžãæããã©ã°ã€ã³ã¯èªèšŒå°çšã§ã¯ãªããããã¥ã¡ã³ãã«ããããã«ãå€ãã®æ©èœãåããŠããŸãã
Postman èªèšŒ¶
æå®ãããä»æ§ã Postman ã³ã¬ã¯ã·ã§ã³ ID ã§ããå ŽåãPostman ã³ã¬ã¯ã·ã§ã³ã®èªèšŒã䜿çšãããŸãã
çŸæç¹ã§ãµããŒããããŠããèªèšŒæ¹æ³ã¯æ¬¡ã®ãšããã§ãã
- API ããŒ
- ãã¢ã©ãŒ ããŒã¯ã³
- ããŒã·ãã¯èªèšŒ
- OAuth 2.0 (ããŒã¯ã³ã¯ synced ã§ããå¿ èŠããããŸã)
çŸæç¹ã§ã¯ããã©ã«ããŒãŸãã¯ãªã¯ãšã¹ãã«å¯ŸããèªèšŒã¯ãµããŒããããŠããŸãããMayhem ãžã®åŒæ°ã§èªèšŒæ å ±ãæå®ãããšãPostman ã®èªèšŒæ§æããªãŒããŒã©ã€ããããŸãã
åæ¹å TLS¶
ããã©ã«ãã§ã¯ãmapi
ã¯ãµãŒããŒã ãã蚌ææžãå
±æããåŸæ¥ã®ã1 æ¹åã TLS ãèªåçã«ãµããŒãããŸãã
åæ¹å TLS (mTLS) ã§ã¯ãã¯ã©ã€ã¢ã³ããšãµãŒããŒã®äž¡æ¹ã蚌ææžãæ瀺ããä¿¡é ŒãããèªèšŒå± (CA) ã«åºã¥ããŠäºããä¿¡é ŒããŸãã
mapi
CLI ã¯ãã¿ãŒã²ãã API ãšã®éä¿¡ã«ãã㊠1 æ¹åã® TLS ãšåæ¹åã® mTLS ã®äž¡æ¹ããµããŒãããŠããŸãã
ãµã³ãã« - RSA, SEC1 Elliptic Curve ãŸã㯠PKCS#8¶
--ca-cert
(ä»»æ) ãµãŒããŒã®èšŒææžã«çœ²åãã CA ã«æå±ãã CA 蚌ææžã§ã (OS ã®ä¿¡é Œããã蚌ææžã«ãŸã å«ãŸããŠããªãå Žå)--cert
ã¯ã©ã€ã¢ã³ã蚌ææžã§ã--key
ã¯ã©ã€ã¢ã³ãã®ç§å¯éµã§ã
mapi run [...] --ca-cert ca.crt --cert client.crt --key client.key
ã¯ã©ã€ã¢ã³ã蚌ææžãšéµã 1 ã€ã® .pem
ãã¡ã€ã«ã«çµ±åããå Žåã--cert
åŒæ°ã§ã¯ãªãããã䜿çšããããšãã§ããŸãã
mapi run [...] --cert client.pem
ãµã³ãã« - PKCS #12 (p12/pfx)¶
--ca-cert
(ä»»æ) ãµãŒããŒã®èšŒææžã«çœ²åãã CA ã«æå±ãã CA 蚌ææžã§ã (OS ã®ä¿¡é Œããã蚌ææžã«ãŸã å«ãŸããŠããªãå Žå)--p12cert
PKCS #12 ã¢ãŒã«ã€ã ãã¡ã€ã«ã§ã--p12password
ã¢ãŒã«ã€ã蚌ææžã埩å·åããããã®ãã¹ã¯ãŒãã§ã
mapi run [...] --ca-cert ca.crt --p12cert client.p12 --p12password "SECRET"
p12password
ãç°å¢å€æ°ãšããŠæ¿å ¥ããããšãã§ããããšã«æ³šæããŠãã ããã
export P12_PASSWORD=SECRET
mapi run [...] --p12cert client.p12
ããã㌠ã·ãŒã¯ã¬ããã®æ嶶
äœããã®çç±ã§ããã¹ã察象ã®ãµãŒãã¹ã«ãã£ãŠçæãããããããŒã«æ©å¯æ§ããããã¬ããŒãããåé€ããããµãã¿ã€ãºãããããå¿
èŠãããå Žåã--redact-header
ãªãã·ã§ã³ãå©çšã§ããŸãã ãã®ãªãã·ã§ã³ã䜿çšãããšãCLI ã¯ããããŒã®ãã¹ãŠã®å€ã <REDACTED>
ã«çœ®ãæããŸãã
ããšãã°ã--redact-header "x-my-proxy-token"
ãæž¡ããšãx-my-proxy-token
ãšããååã®ãã¹ãŠã®ãªã¯ãšã¹ããŸãã¯ã¬ã¹ãã³ã¹ ããããŒã®å€ã <REDACTED>
ã«å€ããããŸãã ãªã¯ãšã¹ãã« x-my-proxy-token: Foo-42
ãšããããããŒãããå ŽåãããããŒã®ã¬ããŒã㯠x-my-proxy-token: <REDACTED>
ãšãªããŸãã
è¿œå äºå®¶
è¿ããã¡ã«ããå€ãã®èªèšŒæ¹æ³ã®ãµããŒããäºå®ãããŠããããŠãŒã¶ãŒããã®æèŠãæ±ããŠããŸããDiscord ãŸã㯠E-mail support@forallsecure.com ã§è¿œå åžæã«ã€ããŠãç¥ãããã ããã
ããã§ãMayhem 㯠API ã®èªèšŒä»ããšã³ããã€ã³ããå®è¡ã§ããããã«ãªã£ãã¯ãã§ãããã°ããã!
Info
API ã§ãã§ã«åé¡ãçºèŠãããŠããå Žåãå ã«çµæã®è©³çŽ°ã«ã€ããŠæ±ã£ãŠãããã°ã®ãããšã³ããã€ã³ãã®èå¥ãåç §ãããšããã§ãããã
ãããããŸã å®äºã§ã¯ãããŸãããå€ãã®çŸå®ã® API ã«ã¯ãèªèšŒä»¥å€ã«ãç¹æ®ãããŠã©ã³ãã ãã¡ãžã³ã°ã ãã§ã¯ç¢ºå®ã«çºèŠããã®ãé£ããå ¥åèŠä»¶ããããŸãã 次ã®ã»ã¯ã·ã§ã³ã§ã¯ãMayhem ã« API å šäœãæ€èšŒãããçç±ãšæ¹æ³ã«ã€ããŠèª¬æããŸãã