start	end	text
0	1800	Thank you all for coming to my talk.
1880	9600	I wasn't really sure what to expect, but this is Referral to Where Your Rewards Are Mine, Exploring Insecurity and Incentive Rewards Program.
9600	16340	This was a research project I did for my work that I found a lot of interest in and I hope you guys find a lot of interest in it, too.
17660	22440	So just a little bit about who I am, because unless you're one of these people in the front row, you have no clue who I am.
24000	25440	My name is Whit Taylor.
25840	28920	If you see me online, I go by Unity Cyber on all platforms.
29340	32520	I am an application pen tester at Rhino Security Labs.
32720	38240	And outside of that, I do a whole lot of bug bounty hunting, security research on open source projects, things like that.
38360	44580	Proud father and husband to a beautiful wife and a very, very large six and a half month old.
44960	48200	And outside of that, I play the piano.
48200	49760	I do power lifting.
49760	50900	I go fishing.
50900	55400	This is my beautiful family and this is me aura farming in the gym, dead lifting 500 pounds.
55400	58320	I'm going to pause for a second to aura farm for a second.
58780	59900	Yeah, lightweight.
61400	63420	So why refer rewards?
64580	66020	This was kind of a 2 a.m.
66020	70520	hacking thought when I was just up late for no reason hacking and just thought this would be a really great idea.
70520	78520	I wanted to find a piece of web functionality that no one had really looked at and I thought, what's the most boring part of a web application?
78760	83320	Well, refer rewards seemed to fit that bill and I didn't really see anything out there on it.
83780	101600	And so I went ahead and I fired a way and about three days later, the CFP for Bug Bounty Village opened up at which point I had no results and I kind of just said YOLO and sent off this idea to Harley with absolutely nothing ready to present.
101600	102340	No results.
102340	110720	This really could have gone terrible, but I figured I was going to find stuff and I did and I hope you guys find some interest in it.
110720	113080	So a little background on refer rewards programs.
113080	123360	If you've ever gone to a web application, you've probably seen something like this where you can share this link with a friend, they sign up, you get a reward, everyone gets a reward.
124540	130120	It can be monetary value, it can be extra assets within the application.
130120	136820	It kind of varies, but usually it's something monetary like cash or credit on the application.
137180	138960	And companies all over use this.
138960	142780	I haven't really seen a company that hasn't done this in some form or fashion.
142820	151600	Companies from Google, HelloFresh, Robinhood, Etsy, you name it, they probably have a referral rewards program in some form or fashion.
152080	168200	And so the way I'm going to do this talk is I'm going to go into the various technical implementations on how this works, typically, and typically how the relationship is established between the referrer and the referee and how that works in the back end.
168200	172620	And then I'll go into some various findings of which I had along the way.
172740	184360	Disclosure, I'm not allowed to disclose any of the actual technical details of the bugs, but I did the painstaking process of diagramming them all out in a very redacted fashion so that you can at least see how these attacks work.
184800	190540	And so the first implementation you're going to see on a web application is a URL to cookie value.
190600	198800	And so the way this works is that the user receives this referral link, they navigate to the link, and the code on the page extracts that link and adds it as a cookie.
198860	211540	And then the user will end up signing up, they'll do some required action to receive the referral reward, that code is sent along as a cookie, user gets a reward, referrer gets a reward, everyone gets a reward.
212000	220220	The second type is pretty much the same deal except instead of a cookie, there's several requests that are initiated by the client side code.
220220	232740	And so same deal, the user receives this link, they navigate to it, the code is extracted, and usually there is a request that validates whether it's a valid code or not.
232740	238720	If that passes a check, then it's applied in a secondary request to this pending user account.
239500	251620	And then the user will complete sign up and again, you know, they'll have to do some required action, which is usually spending a certain amount, doing this, doing that, and then both parties will end up receiving a reward.
251620	256700	And then thirdly, if you've ever been to an e-commerce site, you've probably seen the option of entering in a promo code.
256700	258840	That's pretty much how this works.
258840	272160	You can share your code with your friend, they'll begin checkout, it'll be applied as a promo code or as a discount, and then the user completes checkout and the rewards are applied to both parties.
272960	281740	And then finally, if you've ever been to a mobile app, almost every single mobile application when sharing any data typically follows this particular code pattern.
282140	285260	I'm not going to go into the details on how Android applications work.
285260	289480	If you want to learn more about that, Live Overflow has a great course on Hackstreet.io.
289840	294820	But typically intents are how data is passed around on Android applications.
295200	302580	And so if you've ever shared anything to any other application, you'll click a button and this is typically what the code will look like.
302800	313100	You'll get a pop-up like this where you can decide which app you want to share it to and then the data will be added to the application for you to send along in whatever form or fashion the app supports.
313940	315580	And so why should companies care?
315580	327200	Well, there's typically a direct or indirect financial impact to the company, whether or even to the user, because a lot of these rewards are monetary, either to the user or from the application.
327200	332900	And so this can have impacts to their revenues, they can be a source of fraud for the application.
332900	338060	So there's a lot of attack vectors that come with this functionality.
338700	347880	And so companies should really address these and it's really under an underserviced area of company security programs where they're not really paying attention to this stuff.
348200	354340	And so the way in which I approached this research was I asked myself a bunch of questions and I wanted to answer those questions.
354340	358360	And so that's how I'm going to deliver all of these different bug classes to you.
358360	360840	And so the first thing I wanted to find were client-side gadgets.
361180	373420	And if you don't know what a gadget is, it's a bug that's not really impactful such as an open redirect, a client-side patch reversal, something that you can't really submit right then, but if you chain it with something else, you can make it very impactful.
373420	380520	And so that's something I look for often in my hacking and so I wanted to see if this kind of functionality would bear any fruit in that area.
380520	381660	And it turns out that it did.
381660	388380	So the first thing that you can really find in this area, particularly with technical implementation one, is cookie injection.
388460	399240	So when the application's taking your referral code and it's adding it to a cookie, if you can somehow break out of that cookie value context, you can do a lot of things with cookie injection.
399740	414340	This can lead to cookie tossing if you can completely break out of the context of the cookie, you can inject set cookie headers and you can set arbitrary cookies on the site and you can do some really nasty things that can do anything from take over the account,
414340	432620	you can do cookie bombing in the same form or fashion which you can just overflow the user's cookie jar with so much data that the request breaks and it won't allow them to navigate to the site, or if you can only break out of the cookie value and set arbitrary cookie attributes for that cookie,
432620	438300	then you can do cookie fixation and you can accomplish certain things and that will come up later in the talk.
438900	441300	And then secondly, client-side patroversals.
441300	463260	If you don't know what that is, it's when a value in the URL is concatenated on to a fetch request, XHR request, something like that, and it's used to construct an API call and typically, like in the diagram here, you can put it in a patroversal sequence into a parameter like this and instead of it making a request to slash API users one,
463260	478900	you can make it traverse all the way up the path and you can control where that request is sent and that can be very impactful, you can get XSS from it, you can bypass CSRF mitigations and get cross-site request forgery and it can be very impactful when combined with other gadgets.
479240	488280	And so if you want a resource on CSPTs, I highly recommend this blog, they've got a lot of stuff there, really great to check out.
489760	490180	All right.
490180	492900	My second question was, can I abuse the logic?
492900	494920	I'm a big business logic error hunter.
495120	505460	I love finding ways in which you can abuse the logic, abuse the assumptions that developers made, and I was very certain that there was some complex logic in which developers were making assumptions.
505600	506560	And I was correct.
506560	511460	And one of my favorite vulnerabilities that I found was something called the infinite credit flaw or the infinite money flaw.
511460	513360	I found this on a couple programs.
513820	525320	Typically the requirement here is the application allows sign up with alias email, so if you have user plus one at gmo.com, user plus two at gmo.com and so on, that's what I mean by alias emails.
525540	537020	And then typically it would require no, there would be no requirement for new users to start referring users, and the reward for a referral ends up being greater than the spending requirement for this referral.
537400	552260	And on this particular target, while I can't name drop, current users could refer friends, new users would sign up and make a purchase of X dollars, and then that user would, and the referring user would receive store credit several times greater than the required spend.
552260	557720	And so the way that this works, and this is a bit complex, so I'll pause at the end for you to get the diagram.
558260	559780	You start with two accounts.
560180	564460	Your goal is to get user one as much credit as possible.
564460	567380	And so you start by referring user one.
567700	569560	User one buys and triggers the reward.
569560	573340	You go back and you refer user two and buy and trigger the reward.
573340	575000	And so now both of these accounts have credit.
575000	579340	And this is the last time you will have to spend any money out of pocket on this particular website.
579340	582120	Everything else is from credit you generate from the application.
582420	585100	And then you just continue this with user three and user one.
585320	587520	User four and user one and so forth.
587580	591480	And I was able to generate thousands of dollars of credit on this particular application.
591720	595300	And the program rewarded me with $150 bounty.
603380	607980	And that will be the theme pretty much of this entire talk.
607980	612980	Bug bounty was not kind to me in this research, but I hope you can take it and do something more with it.
613220	621080	The second idea that I had was a lot of these applications would require you to make an order before you could refer.
621080	631460	And I wanted to see if I could somehow circumvent that logic or find a way to not complete that process in order to bypass that logic.
631460	635240	And so in this case, the application requires an order before referral.
635240	639540	Orders are not automatically processed and order cancellation is allowed.
639540	645940	And in this case, this particular target, the user is required to make an order before a referral code is unlocked.
645940	648780	And you could use that referral code to discount orders.
648780	652460	And so here again, I signed up with two accounts.
652960	656420	User one would shop and checked out with a scheduled delivery.
656420	658500	And that would unlock the referral code.
658500	669940	And then I would then go to user two, I'd shop, I'd check out with that referral code, that my order would be discounted, and then I'd go back to user one, cancel the scheduled order, bypassing the logic that I had in place.
671640	676940	And that was pretty much all that there was to that bug.
677920	680180	This bug rendered no bounty.
680260	685960	A triager told me that there was no CIA impact and ignored my messages for about three months until I gave up.
685960	688500	And it is currently in the mediation black hole.
689040	691720	If you know ways to get out of that, please let me know.
694440	704680	And then one of the other things that I checked, and I'm not going to go through all the business logic flaws, because there were many, I wanted to see if there was a way to refer myself or discount myself.
704760	712400	I was certain that there was an application out there that wasn't validating that the referral code didn't belong to the user who was doing it, and I was correct.
712400	722840	And so the application utilized the referral code as a promo code implementation, and I had to have some way to retrieve this referral code before getting my subscription.
722840	733040	And so the way in which this works, the attacker would sign up for an account, and on this application, as soon as you sign up for your account, it would immediately throw you into the subscription flow.
733040	734700	And this is easy to get out of.
734700	740960	You just force browse back to the root directory, and then you would be able to navigate to your account settings.
741500	748540	And then one of the API requests that gets initiated when you navigate to your account settings would contain your referral code.
748960	761000	And then the attacker just restarts the subscription flow, sorry, and you complete the subscription, discounting yourself, and successfully using your own referral code as a promo code.
761000	764600	I had to make this slide a lot smaller, so I didn't include this detail.
764600	780020	On this particular application, you could continue to cancel your billing at the end of the billing cycle and then redo this attack, and so you could perpetually continue to get 50 percent off each billing cycle, cheating the company out of a lot of money if enough users found out how to do this.
780720	781260	OK.
782420	783440	Race conditions.
783440	789820	I was certain I could find a race condition here, and certainly, and I was successful in doing so.
789820	797540	This is a financial app that I found, and this is the flow in which users would sign up using a referral code.
797740	799220	They'd visit the link.
799220	802020	There'd be a put request that signs the account up.
802060	809580	And then as soon as you send that request, this validation request would get sent, and it really wasn't a validation request.
809580	815360	It really just checked to see if the account existed already or if it had already been referred by the code being used.
815980	836380	And then the final request that applied the referral code was the one that ended up being vulnerable to this, and so using James Kettle's single packet attack, I intercepted this request and sent it to a repeater and used the send in parallel, and I was able to generate a whole bunch of rewards just off of a single referral.
836980	839640	This was also one of those fun bug bounty moments.
839960	850300	Dealing with the program, there was a lot of user verification to the point where you had to verify using your social security number, and so they outright refused to get me a second account to confirm this attack.
850420	862300	And so while I have all these rewards still pending in my account, they won't approve my application, and they told me that there's no possible way that I was going to get those rewards anyways, and so they told me to F off, but they ended up fixing it about,
862300	863660	I don't know, a week later.
866100	869180	And then finally, could I steal referrals?
869180	873820	This was the big question I wanted to answer, and there's a couple ways you can do this.
873820	876000	One of them is super realistic.
876120	878000	Companies will probably care about it.
878000	881080	One of them is really just referral hijacking as a service.
881780	883300	So cookie fixation.
883300	901240	I talked a lot about cookie injection in the client side gadgets, and this particular attack vector is when you would break out of the cookie value and you could set it to a specific path, and so the attacker would send this crafted link that breaks out of the cookie value and sets the path of the cookie,
901240	909200	the path attribute of the cookie to the request that signs the user up or whatever request is applying that referral code.
909500	925340	So victim visits the link, that cookie is stored within that specified path, and the reason that we do this is because according to cookie RFC, the cookie at the more specified path is going to be prioritized over a cookie at a less specified path.
925340	940100	And so what happens is this victim eventually receives a referral link from their friend, and the victim will complete the signup, but because that attacker cookie gets prioritized, our attacker account receives a reward instead of the person doing the referral.
940580	942640	I'll pause for a second for pictures.
947290	950450	And then finally, referral hijacking by mobile design.
950450	974010	I mentioned how mobile apps typically work, and the way in which this attack works is most mobile applications kind of leave this up to the user to not accidentally click on a malicious mobile app that's on their device, and this is really a niche attack scenario in which there's really no reason for the application to leave it up to the user to select,
974010	994470	and in this particular application, there were several buttons, one included send by e‑mail, and the application would set the type to message slash RFC 822, and then it would give that pop‑up where any app that could receive e‑mail data would be possible.
994470	1013130	The way this attack would work is you get your malicious attacker app on the program, you would peruse it as e‑mail, setting the package name to something like a.a.gmail, you'd set the icon of the application to match e‑mail, and then you just wait for the user to accidentally click on your app,
1013130	1026090	thinking that it is the actual e‑mail app, the code within your app would then intercept it, change the data to your referral code, and then pass it on to the intended application in which it's going to, and then the user would be none the wiser.
1027410	1028410	All right, takeaways.
1028790	1033270	I made about 25‑plus submissions, and then I kind of got tired of dealing with it.
1034250	1036790	I made less than $1,000 in bounties.
1038450	1040490	Really frustrating experience.
1040490	1041890	You know, bug bounty is a scam.
1042490	1043210	Sometimes.
1043650	1045370	I had a lot of fun with this.
1045370	1051110	There's some really great parts of bug bounty, but unfortunately, you can have situations like this.
1051110	1060530	Like I mentioned, there were triagers who didn't understand impact and would close as informative without letting me explain the attack scenario, without letting me explain the impact.
1061010	1064510	Companies would cite expected behavior and still fix it.
1064690	1067270	Other companies would eventually fix but not pay.
1067290	1073450	And then others that did would pay super low bounties, which is kind of on me for hunting on programs with low bounty tables.
1073970	1076230	But all in all, really enjoyed the research.
1076510	1077970	It was really an underserviced area.
1077970	1080850	I hope you all got a lot out of it.
1080910	1085350	Hopefully, you know a little more about referral programs than when you came in.
1085350	1089190	And I just want to thank all these people in the front row for being such great support.
1089330	1090390	Thank you.
1096660	1098700	And I went really, really fast.
1098700	1100980	It was great.
1100980	1101660	It was great.
1101660	1101880	Yeah.
1101880	1102400	Absolutely.
1102400	1104520	I have a question.
1106220	1106980	Questions?
1106980	1107520	Okay.
1107900	1110280	How did you submit directly?
1111940	1116720	One of the programs in which I submitted had their own self-hosted program.
1118240	1122400	But it ended up being unexploitable in that scenario.
1122400	1125940	But there were a couple programs that had their own self-hosted programs.
1126080	1128800	But almost everything was through HackerOne or Integrity.
1129980	1132300	And one through BugCrowd.
1144710	1145730	Yeah.
1145730	1151870	So I have a pending vulnerability and a target that I'm not allowed to mention.
1152230	1160950	Because they saw my talk and commented on the submission and wanted to make sure that I wasn't going to name drop them, which is why they were removed from all slides.
1161430	1166810	So I will eventually find out if that's the case.
1177020	1177840	No.
1177840	1181460	So after about 25 submissions, I kind of just called it quits.
1181640	1184820	Because, again, I don't like working for free.
1185460	1193520	And so at the point where I realized that until there was some research out there to back up what I'm doing, I wanted to stop.
1193520	1194500	I may go back.
1194500	1198140	I know that there's some higher profile targets that I want to go after with it.
1198140	1200740	But no, I did not check into that.
1201440	1202320	You think...
1208660	1209780	Probably so.
1209780	1210440	Yeah.
1213600	1217320	So, I mean, it looks like you did a bunch of research on this, obviously.
1217320	1218360	You had a talk.
1218620	1219900	A bunch of good work.
1219900	1223840	But is there anything that you think you missed in targeting this?
1224080	1225120	Absolutely.
1225320	1226220	Absolutely.
1226220	1226540	So...
1226540	1226760	Yeah.
1226760	1229580	What would be the next steps that maybe you didn't?
1229800	1234160	So business logic errors are vast.
1234160	1237260	And you really can't find enough of them.
1237280	1241000	Because every application has its own logic.
1241000	1248100	And so the way in which you impact, you know, the applications that I did, probably you could do something different for other applications.
1248100	1249080	So it really varies.
1249080	1252000	And so, you know, I asked myself a lot of questions.
1252000	1253300	But then I kind of just stopped.
1253300	1256320	So you could really just continue to go down the business logic error route.
1256320	1259460	Because that's really where the most bugs are with this functionality.
1264860	1266980	No, that's a single packet attack.
1269120	1270520	I did not.
1291040	1291840	Oh.
1294740	1299480	So if I could inject arbitrary set cookie headers, my first thing would...
1301000	1303060	I would first look for ATO paths.
1303060	1306320	Because if you can set cookies, then there's some really nasty things.
1306320	1308880	I don't know if you can necessarily get an ATO out of that.
1308880	1311020	Like you'd have to have some other gadgets involved.
1311400	1314360	A great thing to do there, because that's really cookie tossing, right?
1314360	1323200	And so you could leak PII, like set it to a specific path, when the victim goes to update their credit card.
1323540	1325900	You could set your session cookie using that.
1325900	1329360	And so that would be what I would look for first.
1329360	1331460	If I couldn't do that, then yeah, cookie bombing.
1331820	1337320	Cookie bombing to client-side DOS is probably what I would go to next.
1339920	1342060	In other contexts, yeah.
1342300	1351980	I have a couple pending bounties on other targets, on something not related to this, that have been accepted with cookie bombing payloads, yeah.
1365180	1366660	That's a good question.
1366660	1368140	I didn't explore that.
1370440	1371740	That's interesting.
1371740	1372040	Okay.
1372040	1372560	Yeah.
1372700	1374560	I'd have to look into that.
1383540	1385480	Oh, God.
1386260	1388520	Clearly not thousands of dollars.
1389720	1390860	That's a good question.
1390860	1391900	I don't know.
1396200	1397400	Potentially.
1397880	1398740	Potentially.
1398740	1402280	Like I don't have a definite answer there, but potentially.
1409410	1410450	But the financial...
1412290	1413650	Yeah.
1421570	1437450	So to that point, I really hate that I can't talk about a very specific scenario, but a company that runs a bug bounty platform on their platform has a selection for fraudulent transactions.
1438010	1443450	And so that makes me think, yes, but they have to care about it.
1443670	1446670	And so if it's a target like that, then yeah.
1446970	1448770	I think they'll pay.
1448770	1450530	But again, I don't know.
1455830	1456870	No.
1460290	1462770	They were always implemented by the company.
1465470	1466490	All right.
1466590	1467850	Thank you very much.
1469810	1471150	Thank you.
1471150	1471710	Thank you.
