start	end	text
0	4840	It is my pleasure to introduce Vikas to the stage. Let's give him a round of applause.
10580	19580	Hello. I hope you can hear me. Thanks for the warm welcome. So welcome to the talk and
19580	24920	I hope you are having a good time so far. So my topic for today is authentication bypass
25560	33060	and account takeovers. So this talk is for people who are in pentesting, who are doing
33060	38580	red teaming activities and who are in bug bounty hunting. Other than that, if you are
38700	43900	a student or new to this field, this is for you as well. So I hope you will enjoy it.
45400	51280	All right. So the agenda for today's talk is I have divided it in three different phases.
51280	56180	First is introduction. I will discuss about what authentication is, why it's so crucial
56180	61020	and what are the different modules where you can look for such bugs.
61020	70000	The phase two is techniques and vulnerabilities, which I personally use to take all the accounts
70000	75380	and bypass the authentications during my entire career. I mean, I have eight years of experience
75380	79940	and I have used these techniques during the pentesting activities, red teaming activities
79940	87120	and bug bounty hunting. The third phase is I identified account takeover or authentication
87120	97130	bypassing Apple. I will disclose that. A little bit about myself. My name is Vikas Khanna.
97130	104970	I am a technical specialist at Privasec. My key focus is on AppSec, web applications,
104970	110790	API security. Whenever I'm not working on my professional stuff, I am a bit active on
110790	117310	bug bounty hunting. I got acknowledgments from companies like Google, Microsoft, Apple
117310	124650	and many more. Other than that, I have contributed to the community. I have contributed to OWASP,
124650	132590	WSTG and OWASP www community. Other than that, I have a few CVs from Oracle and IBM for reporting
132590	139870	them issues in their enterprise products. All right. So what is authentication? Basically
139870	145990	authentication is a process to verify a user or a system that they are what they are claiming
145990	152310	to be by verifying their credentials in terms of their user names, password, digital signatures
153030	160430	and many more things. Authentication is very crucial. For example, there are post-login
160430	168570	modules which are having sensitive information, your PIIs and information which not everybody
168570	172830	should be able to see without logging into the application. So that is why authentication
172830	181170	is very crucial. Okay. So whenever we are hunting for authentication bypass and account
181170	189630	takeovers, these are the abusable vectors or functionalities where you can focus on.
190170	197270	Basically I have identified issues in these features, these functionalities, but this
197270	201750	bug is not limited to these features only. I mean you can explore. But this is based
201750	210250	on my experience. Okay. Real-time abuse vectors like vulnerabilities and techniques which
210250	217130	you can use basically to take over the accounts and bypass those indications. All right. First
217130	221750	vulnerability is session puzzling. What is session puzzling? Session puzzling is like
221750	230890	whenever you have extra permissions on your session ID. For example, you are in pre-login
230890	238170	stage and for some modules or some activities you got a session ID and that session ID is
238170	244150	misconfigured and having a permission over permission which you can use to access the
244150	249730	post-login modules as well. Basically it's in pre-login stage but you can access post-login
249730	257690	modules as well. All right. So the example for this is forgot password functionality.
257690	263010	How forgot password functionality works? Like there is a forgot password module. You can
263010	268790	enter your email ID. Application will redirect you to another page where application will
268790	276270	ask you for OTPs or maybe security questions. And if you provide OTP, correct OTP or correct
276270	280910	security questions answer, application will redirect you to another page where you can
281610	286550	enter the new password and change the password. But for the second page where application
286550	292370	is asking for security questions answer or OTP, application have created a session which
292370	298170	is linked with your email ID which you provided on the first page. But that if the application
298170	303990	is misconfigured and that session variable, session ID is having over permissions you
303990	309890	can without entering the security answer or OTP you can access the post-login modules
309890	316330	by just using that particular session ID because it is activated globally. So this issue I
316330	321170	have identified in Apple and I will show in the later slides.
322970	329990	All right. Other vulnerability session fixation. As name suggests that in this vulnerability
329990	337150	you can fix the session in pre-login stage. Basically the pre-login and post-login session
337150	344070	variables value will remain same. It will be just the state of the session token which
344070	352750	will become active or deactive. All right. So there are two ways we can use this vulnerability.
353070	361910	One is whenever your victim is in the remote location. So how you can leverage that? So
363010	370450	if you are able to get the session ID in URL in pre-login stage what you can do, you can
370450	376290	copy that and send it to your victims. All right. Whenever your victim will click on
376290	382410	that link, since the link belongs to the legitimate application, victim will click on that and
382410	388170	will enter the credentials. When victim will enter the credentials, the session ID will
388170	393150	become in an active state. Since you are the one, you are the attacker, you have the session
393150	399170	ID, you can use it on your machine and you can log in to the victim's account directly.
399170	404410	You don't have to enter the passwords. So that's how you can bypass the authentication
404410	411850	and take over the accounts. This is when your victim is remote. The other thing is whenever
411850	417270	let's say you are working on a shared machine, there is a machine which is shared by multiple
417270	424430	users. So what you can do, you can go to that machine, you can copy the cookies. Since pre-login
424430	428910	and post-login cookie will be same, you can just copy that and whenever your victim will
428910	433370	log in to that particular application, you can use that cookie and you can bypass the
433370	442150	authentication by using victim's account. All right. The other is access control checks.
442830	448150	IDRs, IDRs are best friends. We can use that to perform a number of activities and one
448150	453310	of them is account takeovers and authentication bypasses. So how you can take over the accounts.
453310	458190	For example, application performing some sort of sensitive activities like change password,
458190	466030	update profiles by just checking the user's ID. Sometimes it's in even hidden parameters.
466170	471550	You can use tools like client side proxy tool like Bob suit and you can just modify the
471550	476370	user ID and if the application is vulnerable, you will be able to take over the accounts
476370	483330	of your victims. The other is privilege escalations. Let's say if you are performing gray box assessments
483710	490970	as a pen tester. So you will be aware with admin level modules as well and non-privileged
490970	496850	user or non-admin users modules as well. So you can log in into the least privileged user
496850	501930	account and you can try to access the admin account. And if the application is vulnerable
501930	508650	to access controls and privilege escalations, you can access the admin level modules. Depending
508650	515350	on the application's functionality, let's say there could be a number of sensitive modules
515350	520610	where you can play with maybe let's say there is an admin module where you can see the number
520610	526190	of users. You can deactivate their accounts. You can change their passwords. You can block
526190	530530	them. Depending on the application's functionality, you can do a number of things.
531130	536830	Other thing is forced browsing. Forced browsing is something when you are forcefully trying
536830	543570	to access post authentication modules by just hitting them without providing any credentials.
543730	549090	If there is access control bug, you will be able to access the post login modules as well.
549230	554770	And let's say there are configuration files which are not linked with the application
554770	560030	but are still present in the server. So you can access those configuration files and it
560030	564950	will share, it will disclose a lot of sensitive information depending on what kind of configuration
564950	566310	file is there.
567190	576330	All right. Next is password reset link hijacking or poisoning by using host header injection.
577030	582270	So let me explain what is host header injection and how it works first. Then we will dig into
582270	588330	how we can abuse it. So whenever you are hitting an application, application verifies, okay,
588330	595810	what's the value of host header, its origin, and accordingly application will fetch the
595810	602750	responses from that particular application server and assign to you the resources. So
602750	609270	whenever you are having redirection, 301, 302, you can use host header vulnerability.
609270	613670	You can change the host header's value and you can check the location header if your
613670	618990	host header's value is getting reflected into the location header in the response itself.
619390	625170	How you can use it to take over the accounts? So for example, there's a password functionality,
625170	629850	you can go there, you can enter your victim's email ID, you can capture the request by using
629850	637490	Bubsuit and you can change the host value to the domain which you can control. All right.
637490	644350	So here 0xnoob is, for example, my domain. I'm an attacker. All right. So I can enter
644350	649490	my victim's email ID, I can capture the request, and I can change the host header value to
649490	654390	0xnoob. So what application will do? How forgot password functionality works? Application
654390	660350	will send you a reset token link to your email ID, you can click on that and update the password.
660530	664870	But here, since you have updated the host header value, application server will send
665770	672850	a password reset link to your email ID with the password reset token, but the URL which
672850	681170	will be embedded will be 0xnoob, or the domain which you will provide. All right. So since
681170	687350	it is coming from the legitimate application server, victim will click on the link. You
687350	692570	can use it in red teaming activities. You can try it on pentesting, bug bounty hunting.
693290	699730	Victim will click on that particular link, and you can go to your server logs, and you
699730	706590	can capture the, you can grab the reset token. Since it's still in the active state, because
706590	711910	victim haven't used it on legitimate application yet. So you can go to the legitimate application
711910	717890	and embed that particular token, and that's how you can take over the accounts, because
718030	722770	a token is still in active state. You can enter the credentials, and you can change
722770	726370	the credentials of your victim. That's how you can take over the accounts.
728250	735970	JS files. A lot of people usually don't get into the JS files. They don't bother about
735970	742430	it. But JS files are something which are very crucial, and sometimes it's having some sort
742430	748050	of sensitive stuff, funny stuff, I mean, depending on, you know, what sort of stuff
748050	754190	is that. So you can find API keys, you can find credentials, you can even find the sensitive
754190	773820	API endpoints. PHP type juggling. Give me a moment. So type juggling is a feature of
773820	780880	PHP. What does it mean? So it's a functionality of PHP where you can have a lot of different
780900	787160	parameters, where you don't have to define the data types. PHP will do it for you. Whenever
787160	795480	PHP will perform any operations or comparisons on the variables or parameters, PHP will convert
795480	800460	the data type accordingly and perform the action. For example, the first parameter is
800460	808060	number 1, which is a string, 10 is in double quotes. The second parameter is number 2,
808060	813320	which is 5, which is integer. And in third parameter, we are performing operation, additional
813320	821120	operation. So whenever we are performing addition, PHP will convert string, which is 10, to an
821120	830140	integer and will perform the addition operation. So the result will be 15. 10 plus 5 is 15.
831120	838800	So the other thing is comparison. Whenever PHP will perform a comparison by using 2 times
838800	847200	equals 2. So what PHP will do, first parameter here is integer, second is string. So the
847200	853220	second parameter's value is 10 abc, which is a string. Whenever you will perform a comparison
853220	861680	operation here, PHP will convert that string 10 abc to 10, which will become integer. And
861680	867200	then PHP will perform the action accordingly. So 10 is equal to 10, so the result will be
867200	871580	equals. How we can leverage it to take over the accounts.
873740	883200	So let's say there is a value of parameter which don't have the integer. So if you will
883220	889360	convert that string with the integer, PHP will convert that string to zero and then
889360	895800	it will compare with the user's provided input. So for example, the admin's password is not
897600	904040	having integer value, having a string only. So as an attacker, you can mention zero in
904040	910620	the password. PHP will compare it with admin password. Admin password is a string. PHP
910620	917040	will convert admin's password to zero and zero is equal to zero will become a true statement.
917140	923920	That's how you can bypass the authentication. But there is a prerequisite. It should be
923920	930660	JSON or serialized object. Then only you will be able to perform this attack.
933460	940160	CSRF, let's say if in the application CSRF tokens are missing and there is no CSRF protection
940160	946140	and there is a module where you can update the mobile number, email ID, you can craft
946300	952280	a HTML page and send it to your victim. If that victim is logged in into their account,
952280	958280	you can literally update their mobile numbers and email address. Once you will be able to
958280	965460	do that, you can request for forward password by entering the email or mobile number which
965460	973320	you have mentioned during the HTML page creation. Then you can take over their accounts because
973320	978700	application will send the OTPs or password reset links to their phone number and email
978700	985900	ID which belongs to the victim's account. Let's say if there is a forward password functionality
985900	991140	where application is not asking for old passwords and application is vulnerable to CSRF, you
991140	995940	can just craft a request and send to your victim and you will be able to change the
995940	998580	password. From there you can take over their accounts.
999680	1006080	HTTP parameter pollution. It's a vulnerability where you can mention multiple parameters
1006880	1011480	with the same name but the values will be different and the application will perform
1011480	1016980	the action on the basis of that. So let's say there is a forward password functionality
1016980	1025840	and you can mention maybe you can use that one parameter for twice, for two times and
1025840	1032680	mention the victim's email ID plus your own email ID. So if the application is vulnerable,
1032680	1039480	application will send password reset token to both the email IDs. But it will be activated
1039480	1046520	for one account only. Depending on how application is doing that. Maybe it is validating the
1046520	1050760	first parameter or second parameter. That you have to figure out. It depends on different
1050760	1058740	applications. So accordingly, let's say whenever you receive that link, you can just go to
1058740	1063840	application and you can just change the password of your victim and you can take over the account.
1063840	1068640	You can try this on reset password, update password, wherever you are receiving OTPs
1068640	1070600	you can try that vulnerability.
1072260	1082160	Authentication bypasses by using response manipulation. So a few applications are validating
1082160	1090780	the previous response and then perform the next action. So let's say the response is
1090780	1097140	on the basis of true or false. If you have provided the right credentials, application
1097140	1104780	is throwing you the true response. And if you have provided the wrong credentials, application
1104780	1110300	will throw the false response. So you can change that to true and you can perform the
1110300	1116780	next action. You can bypass. Accordingly, you can manipulate the status codes. If application
1116780	1125080	is throwing 400 or something for wrong credentials and throwing 200 OK for right credentials,
1125080	1134600	you can try to manipulate that. Two-factor authentication or OTP, you can break that.
1134980	1141900	How? So whenever you are performing pen testing specially, you can use these things. You can
1141900	1149480	check for the integrity validation of OTPs. For example, I can send OTP to my mobile number
1150000	1157000	and send OTP to my victim's mobile number. So these two OTPs are in active state now.
1157020	1164560	Because neither I used nor my victim used it for now. So what can I do? Since both the
1164560	1171380	OTPs are in active state, I can check the integrity. I can try my OTP on my victim's
1171380	1176140	account just to validate that application is checking the integrity of the OTP or not.
1176140	1185400	And trust me, it's still working. Reusability of OTPs, you can try to reuse the OTPs. And
1185400	1195920	the third one is I found it in one of the most popular banks. So they were disclosing
1195920	1204380	the OTPs in the responses. So I mean, go for it, check for responses as well. Master OTPs,
1204380	1211580	I found it in one of the net banking applications. The master OTP was six times zeros. So you
1211580	1215940	can log into any account by using six times zero. I mean, you can try for other stuff
1215940	1227600	also. So go for it. All right. Brute force. So whenever we are thinking about brute force,
1227600	1232920	we are trying to brute force the passwords. We can try another way as well by using password
1232920	1239680	spraying attack. We can brute force the emails by using one password. We have one password
1239680	1245120	and we can try that on multiple users. We can try to brute force in that way as well.
1245140	1248680	So whenever you are performing red teaming activities or bug hunting or something, you
1248680	1255460	just need one account to perform your actions. So this will be very handy. Try to check if
1255460	1262560	there are rate limiting controls are enabled or not. Other than that, sometimes application
1262560	1268920	is blocking your IP address whenever you are performing brute force attacks. So you can
1268920	1275520	hop on different IP addresses. You can change your IP addresses depending on how application
1275520	1281740	is blocking it. Maybe after 15 requests or 50 requests. And just before less application
1281740	1288600	is blocking IP after every 50 requests. You know, within maybe some sort of time foundation.
1288700	1297620	So you can change your IP on 49th attempt. Accordingly, you can try that. You can send
1297620	1304820	multiple credentials in request to validate that, I mean, it is working or not. There
1304820	1313340	is a very, very good lab of web security academy. Please check that. Default credentials. If
1313340	1320500	you are, okay, this is very, very handy in red teaming activities. So, I mean, almost
1320500	1326600	every organization is using enterprise products. Go for it. Check for the default credentials.
1326600	1334140	I mean, it's still working. I usually find that. WordPress. It is one of the most popular
1334140	1343980	CMS. So there is a so-called feature in WordPress where you can use author parameter just to
1343980	1350560	verify that what's the user name of one. I mean, let's say if you will enter the author's
1350560	1355040	value one, it will show you the first user of that particular application. If you will
1355040	1359760	change it to two, it will show you the second user of that particular application. It will
1359760	1364620	show you the user name. It will show you the posts which are done by that user. It might
1364620	1370460	show you the comments as well. So accordingly, you can, you know, enumerate user's information.
1371020	1378260	And whenever you are performing WP scan, don't perform directly from the, you know, without
1378260	1385900	using API keys. Please use API key. You can go to WP scan website. You can get API key.
1385900	1391180	It's free of cost. And by using that particular API key, if you will perform the WP scan,
1391180	1397680	the results will be definitely different. In secure logout management, whenever you
1397680	1404460	are working on pen testing, check for these things, especially for banking applications.
1404460	1408760	For example, reuse of session. Check if you can reuse that particular session. Login to
1408760	1414200	the application, logout from the application. Check if you can still use the old sessions.
1414820	1420320	Close the browser for the sensitive applications. Whenever you are closing the browser, it should,
1420320	1426040	you know, dissolve the entire session at the server side. Let's say if there is a net banking
1426040	1431300	application and you are closing the browser, whenever you are again accessing the application
1431300	1437940	by using new tab, it shouldn't work. Application should ask you for the login. Session should
1437940	1442840	bound to IP address for sensitive applications. For example, as an attacker, if I am able
1442840	1452320	to get the session of my victim, okay, but if that is bound to their IP address only,
1452320	1461220	I won't be able to use that. Check for it. All right. So tips for red teamers and pen
1461220	1467740	testers. Go to pastebin whenever you are performing red teaming activities. Go to pastebin. Pastebin
1468500	1473980	have a lot of sensitive stuff. DHash, go for DHash. I mean, you can find the passwords
1473980	1481140	of your victims. Open bug bounty. So this website is very handy. I use it multiple times
1481140	1488040	and it helped me a lot. So you can find a lot of vulnerabilities which are identified
1488040	1497000	by other attackers. All right. And they have disclosed those vulnerabilities publicly because
1497000	1507060	the vendor is not entertaining them. All right. So you can use those vulnerabilities. My first
1507060	1513900	bug, I found it in Apple. I found account takeover or authentication bypass basically.
1513900	1526830	I will call it authentication bypass. So that was my first bug in Apple. So this was session
1526830	1535730	puzzling which I explained in the earlier stage. So I was able to get the session variable
1535730	1545290	which was active for post-login modules as well in the pre-login stage. So here I am
1545290	1552630	on login page. I'm trying. Okay. Application is redirecting me to the login page only.
1552630	1560050	There is a story behind that. So the domain name is InstaVision.Apple.com. If I will go
1560050	1567810	to that domain directly, it will redirect me to the SSO of Apple. Based on my understanding
1567810	1572850	it is a bit secure. I haven't tested that to be honest. But based on my understanding
1572850	1580750	it is secure. So then I did some sort of Google docking and I got to know that there
1580750	1588430	is a sub-directory with a random string folder name and there is a login module there. So
1588430	1597650	I tried to hunt here. I removed the login page. Application is redirecting me to login
1597650	1604970	again. Here it is. So application is asking me for a username and password. So I will
1604990	1621000	say username and e-mail address. I provided a fake username and fake e-mail ID. Okay.
1621000	1632160	I got an error. Please try again. But for this particular thing, when application was
1632160	1637880	throwing me an error, application created a session which belongs to my e-mail ID and
1637880	1643780	they have activated it for the entire application. And which was linked to the admin module.
1648750	1663540	Now I tried to remove the login and try to access the sub-directory. Boom. Thank you.
1665690	1673630	So here I was able to download the confidential details. I have blurred a few contents because
1673630	1691760	of sensitive information. So yeah, I was able to download as well. Okay. Let's discuss
1691760	1710400	if you have any questions. Yeah, please. So WP scan, if you will use it without API key,
1710400	1717400	it will definitely give you results. But with API keys, I used it in some sort of CTS and
1717400	1722260	even during my red teaming activities, it will give you extra privileges, extra features
1722260	1732260	to use that. So by using that extra privileges, you can get more information. Sorry? No, no,
1732260	1738600	no. You can go to WP scan website and you can create a custom key for yourself only.
1738600	1747380	So that will be linked with your account. Yeah, please. Sorry? Yeah, please.
1749360	1760540	Yeah, it is there. Yeah. No, so we were not discussing about traditional brute force.
1760540	1764280	We were discussing about how you can, you know, if there is still, there is brute force
1764280	1777620	protection, how you can bypass it. So we were discussing about bypasses. Yeah. Please.
1793560	1802530	Obviously, I'm still exploring that, that particular things. So yeah. But yeah, when
1802550	1809010	it question, I mean, I look into it. I'll definitely look into it. Thank you so much.
1811270	1816730	Excuse me. Last thing. I'm still working on authentication bypasses stuff. And if someone
1816730	1822950	from you guys is working on authentication bypasses, feel free to reach out to me. I
1822950	1827490	will be more than happy to collaborate and, you know, work more on it. Thank you so much.
