start	end	text
8220	13460	My topic for today is authentication bypass and account takeovers.
14140	23420	So this talk is for people who are in pen testing, who are doing red teaming activities and who are in bug bounty hunting.
23700	28360	Other than that, if you are a student or new to this field, this is for you as well.
28440	30220	So I hope you will enjoy it.
31920	37620	So the agenda for today's talk is, I have divided it in three different phases.
37620	47420	First is introduction, I will discuss about what authentication is, why it's so crucial and what are the different modules where you can look for such bugs.
48400	60300	The phase two is techniques and vulnerabilities, which I personally use to take over the accounts and bypass the authentications during my entire career.
60300	67900	I mean, I have eight years of experience and I have used these techniques during the pen testing activities, red teaming activities and bug bounty hunting.
68620	75480	The third phase is, I identified account takeover or authentication bypass in Apple.
75480	77020	I will disclose that.
79680	86500	Little bit about myself, my name is Vikas Khanna, I am technical specialist at Privasec.
86500	98560	My key focus is on AppSec, web applications, API security, whenever I'm not working on my professional stuff, I am bit active on bug bounty hunting.
98820	105320	I got acknowledgements from companies like Google, Microsoft, Apple and many more.
105360	108200	Other than that, I have contributed to the community.
108220	114380	I have contributed to OWASP, WSTG and OWASP www community.
115140	122120	Other than that, I have a few CVs from Oracle and IBM for reporting them issues in their enterprise products.
122120	124100	All right.
124600	126060	So what is authentication?
126080	133400	Basically authentication is a process to verify a user or a system that they are what they are claiming to be.
133680	141400	By verifying their credentials in terms of their user names, password, digital signatures and many more things.
142500	158620	Authentication is very crucial, for example, there are post login modules which are having sensitive information, your PIIs and information which not everybody should be able to see without logging into the application.
158620	160880	So that is why authentication is very crucial.
162280	176240	So whenever we are hunting for authentication bypass and account takeovers, these are the abusable vectors or functionalities where you can focus on.
176240	186060	Basically I have identified issues in these features, these functionalities, but this bug is not limited to these features only.
186060	187460	I mean you can explore.
187580	189820	But this is based on my experience.
191980	201600	Okay, real time abuse vectors, like vulnerabilities and techniques which you can use basically to take over the accounts and bypass the authentications.
202520	205980	All right, first vulnerability is session puzzling.
205980	207100	What is session puzzling?
207100	232580	Session puzzling is like whenever you have extra permissions on your session ID, for example, you are in pre-login stage and for some modules or some activities you got a session ID and that session ID is misconfigured and having a permission, over permission which you can use to access the post login modules as well.
232580	237620	Basically it's in pre-login stage, but you can access post-login modules as well.
239580	244260	All right, so the example for this is forgot password functionality.
244260	264520	How forgot password functionality works, like there is a forgot password module, you can enter your email ID, application will redirect you to another page where application will ask you for OTPs or maybe security questions and if you provide OTP, correct OTP or correct security questions answer,
264520	270660	application will redirect you to another page where you can enter the new password and change the password.
270800	283060	But for the second page, where application is asking for security questions answer or OTP, application have created a session which is linked with your email ID, which you provided on the first page.
283220	301060	But if the application is misconfigured and that session variable, session ID is having over permissions, you can, without entering the security answer or OTP, you can access the post-login modules by just using that particular session ID, because it is activated globally.
301560	307560	So this issue I have identified in Apple and I will show in the later slides.
309160	312740	All right, other vulnerabilities, session fixation.
312740	320560	So , as name suggests that in this vulnerability, you can fix the session in pre-login stage.
320560	327380	Basically, the pre-login and post-login session variables value will remain same.
327380	333600	It will be just the state of the session token which will become active or deactive.
333900	334760	All right?
334760	339300	So there are two ways we can use this vulnerability.
339300	346220	One is whenever your victim is in the remote location.
346220	347960	So how you can leverage that?
348360	360280	So if you are able to get the session ID in URL in pre-login stage, what you can do, you can copy that and send it to your victims.
360460	360820	All right?
360820	371400	Whenever your victim will click on that link, since the link belongs to the legitimate application, victim will click on that and will enter the credentials.
371580	376680	When victim will enter the credentials, the session ID will become in an active state.
377200	385880	Since you are the one, you are the attacker, you have that session ID, you can use it on your machine and you can log in into the victim's account directly.
385880	387440	You don't have to enter the passwords.
387920	392600	So that's how you can bypass the authentication and take over the accounts.
392800	396300	This is when your victim is remote.
396300	404800	The other thing is whenever, let's say, you are working on a shared machine, there is a machine which is shared by multiple users.
404880	409400	So what you can do, you can go to that machine, you can copy the cookies.
409680	422000	Since pre-login and post-login cookie will be the same, you can just copy that and whenever your victim will log in to that particular application, you can use that cookie and you can bypass the authentication by using victim's account.
424160	425020	All right.
425020	428940	The other is access control checks.
429460	438700	IDRs, IDRs are best friends, we can use that to perform a number of activities and one of them is account takeovers and authentication bypasses.
438700	440060	So how you can take over the accounts?
440060	449420	For example, application performing some sort of sensitive activities like change password, update profiles by just checking the user's ID.
449920	452800	Sometimes it's in even hidden parameters.
452800	464400	You can use tools like client-side proxy tool like Burpsuit and you can just modify the user ID and if the application is vulnerable, you will be able to take over the accounts of your victims.
464840	466880	The other is privilege escalations.
467600	471900	Let's say if you are performing gray box assessments as a pen tester.
472420	481100	So you will be aware with admin level modules as well and non-privileged user or non-admin users modules as well.
481100	487080	So you can log in into the least privileged user account and you can try to access the admin account.
487440	493920	And if the application is vulnerable to access controls and privilege escalations, you can access the admin level modules.
494900	508380	Depending on the application's functionality, let's say there could be a number of sensitive modules where you can play with maybe let's say there is an admin module where you can see the number of users.
508380	510240	You can deactivate their accounts.
510240	512400	You can change their passwords.
512480	513620	You can block them.
513620	517320	You know , you can, depending on the application's functionality, you can do a number of things.
517900	519760	Other thing is forced browsing.
520440	530380	Forced browsing is something when you are forcefully trying to access post authentication modules by just hitting them without providing any credentials.
530540	535920	If there is access control bug, you will be able to access the post login modules as well.
535920	543640	And let's say there are configuration files which are not linked with the application but are still present in the server.
543760	553100	So you can access those configuration files and, you know, it will share, it will disclose a lot of sensitive information depending on what kind of configuration file is there.
554380	555520	All right.
555700	563180	Next is password reset link hijacking or poisoning by using post header injection.
563180	568480	So let me explain what is post header injection and how it works first.
568480	570900	Then we will dig into how we can abuse it.
571460	587560	So whenever you are hitting an application, application verify, okay, what's the value of post header, its origin, and accordingly application will fetch the responses from that particular application server and assign to you the resources.
589280	596160	So whenever you are having redirection, 301, 302, you can use post header vulnerability.
596160	605820	You can change the host header's value and you can check the location header if your host header's value is getting reflected into the location header in the response itself.
606300	608560	How you can use it to take over the accounts.
608720	623300	So for example, there's a password functionality, you can go there, you can enter your victim's email ID, you can capture the request by using Bobsuit, and you can change the host value to the domain which you can control.
624500	629320	So here, 0xnoob is, for example, my domain, I'm an attacker.
629840	637440	So I can enter my victim's email ID, I can capture the request, and I can change the host header value to 0xnoob.
637820	640960	So what application will do, how password functionality works.
640960	647380	Application will send you a reset token link to your email ID, you can click on that and update the password.
647520	665980	But here, since you have updated the host header value, application server will send a password reset link to your email ID, with the password reset token, but the URL which will be embedded will be 0xnoob, or the domain which you will provide.
665980	679540	All right, so since it is coming from the legitimate application server, victim will click on the link, you can use it in red teaming activities, you can try it on pentesting, bug bounty hunting.
680080	691100	Victim will click on that particular link, and you can go to your server logs, and you can capture the, you can grab the reset token.
691280	696420	Since it's still in the active state, because victim haven't used it on legitimate application yet.
696820	707200	So you can go to the legitimate application and embed that particular token, and that's how you can take over the accounts, because a token is still in active state.
707200	711440	You can enter the credentials, and you can change the credentials of your victim.
711520	713320	That's how you can take over the accounts.
715020	716400	JS files.
717280	723680	A lot of people usually don't get into the JS files, they don't bother about it.
723680	735940	But JS files are something which are very crucial, and sometimes it's having some sort of sensitive stuff, funny stuff, I mean, depending on, you know, what sort of stuff is there.
735940	743400	So you can find API keys, you can find credentials, you can even find the sensitive API endpoints.
745760	748400	PHP type juggling, give me a moment.
758390	762050	So type juggling is a feature of PHP.
762670	763930	What does it mean?
764450	772990	So it's a functionality of PHP where you don't have to define the data types, PHP will do it for you.
772990	785110	PHP will, whenever PHP will perform any operations or comparisons on the variables or parameters, PHP will convert the data type accordingly and perform the action.
785110	792770	For example, the first parameter is number 1, which is a string, 10 is in double quotes.
792990	797170	The second parameter is number 2, which is 5, which is integer.
797510	801550	And in third parameter we are performing operation, additional operation.
801810	812450	So whenever we are performing addition, PHP will convert string, which is 10, to an integer and will perform the addition operation.
812450	817310	So the result will be 15, 10 plus 5 is 15.
818590	821710	So the other thing is comparison.
821710	827290	Whenever PHP will perform a comparison by using 2 times equals 2.
828330	833830	So what PHP will do, first parameter here is integer, second is string.
833990	837650	So the second parameter's value is 10 abc, which is a string.
837650	848610	Whenever you will perform a comparison operation here, PHP will convert that string, 10 abc, to 10, which will become integer.
848670	851770	And then PHP will perform the action accordingly.
851770	855330	So 10 is equal to 10, so the result will be equals.
855730	858730	How we can leverage it to take over the accounts.
858730	868930	All right, so let's say there is a value of parameter which don't have the integer.
869230	880170	So if you will convert that string with the integer, PHP will convert that string to zero and then it will compare with the user's provided input.
880210	888070	So for example, the admin's password is not having an integer value, having a string only.
888070	892350	So as an attacker, you can mention zero in the password.
892810	895490	PHP will compare it with admin password.
895490	897150	Admin password is a string.
897590	904130	PHP will convert admin's password to zero and zero is equal to zero will become a true statement.
904390	906890	That's how you can bypass the authentication.
907230	909690	But there is prerequisites.
910410	915390	It should be JSON or serialized object.
915390	917830	Then only you will be able to perform this attack.
920670	921750	CSRF.
921750	927930	Let's say in the application CSRF tokens are missing and there is no CSRF protection.
928350	932910	And there is a module where you can update the mobile number, email ID.
932910	936210	You can craft an HTML page and send it to your victim.
936210	944530	If that victim is logged in into their account, you can literally update their mobile numbers and email address.
944530	958710	Once you will be able to do that, you can request for a password by entering the email or password, email or mobile number which you have mentioned during the HTML page creation.
958710	960330	Then you can take over their accounts.
960330	970290	Because application will send the OTPs or password reset links to their phone number and email ID, which belongs to the victim's account.
970290	983930	Let's say if there is a password functionality where application is not asking for old passwords and application is vulnerable to CSRF, you can just craft a request and send to your victim and you will be able to change the password.
983930	985850	From there you can take over their accounts.
986930	988810	HTTP parameter pollution.
989130	995710	It's a vulnerability where you can mention multiple parameters with the same name.
995710	997590	But the values will be different.
997590	1001310	And the application will perform the action on the basis of that.
1001450	1005550	So let's say there is a password functionality, all right?
1005630	1012790	And you can mention maybe, you can use that one parameter for twice, for two times.
1012790	1018130	And mention the victim's email ID plus your own email ID.
1018150	1024950	So if the application is vulnerable, application will send password reset token to both the email IDs.
1024950	1028450	But it will be activated for one account only.
1028730	1032390	Depending on how application is doing that.
1032390	1035990	Maybe it is validating the first parameter or second parameter.
1035990	1037230	That you have to figure out.
1037230	1039210	It depends on different applications.
1040150	1051190	So accordingly, let's say whenever you receive that link, you can just go to application and you can just change the password of your victim and you can take over the account.
1051190	1058190	You can try this on reset password, update password, wherever you are receiving OTPs, you can try that vulnerability.
1060470	1064830	Authentication bypasses by using response manipulation.
1066070	1074310	So a few applications are validating the previous response and then perform the next action.
1075150	1080870	So let's say the response is on the basis of true or false.
1080870	1086870	If you have provided the right credentials, application is throwing you the true response.
1087630	1094650	And if you have provided the wrong credentials, application will throw the false response.
1094650	1098410	So you can change that to true and you can perform the next action.
1098410	1099290	You can bypass.
1100070	1102970	Accordingly, you can manipulate the status codes.
1102970	1114310	If application is throwing 400 or something for wrong credentials and throwing 200 OK for right credentials, you can try to manipulate that.
1117190	1122110	Two-factor authentication or OTP, you can break that.
1122370	1123250	How?
1123490	1128690	So whenever you are performing pentesting specially, you can use these things.
1129010	1133290	You can check for the integrity validation of OTPs.
1133290	1140130	For example, I can send OTP to my mobile number and send OTP to my victim's mobile number.
1140130	1145150	Sometimes, so these two OTPs are in active state now.
1145210	1150430	Because neither I used nor my victim used it for now.
1150430	1151270	So what can I do?
1151270	1155230	Since both the OTPs are in active state, I can check the integrity.
1155230	1159370	I can try my OTP on my victim's account.
1159370	1159610	I can try my OTP on my victim's account .
1159610	1163670	Just to validate that application is checking the integrity of the OTP or not.
1163670	1165170	And trust me, it's still working.
1167890	1172170	Reusability of OTPs, you can try to reuse the OTPs.
1172550	1180830	And the third one is, I found it in one of the most popular banks.
1181270	1185490	So they were disclosing the OTPs in the responses.
1185490	1190890	So, I mean, go for it, check for responses as well.
1191050	1194790	Master OTPs, I found it in one of the net banking applications.
1195010	1197530	The master OTP was six times zeros.
1198470	1201350	So you can log into any account by using six times zero.
1201350	1205870	I mean, you can try for other stuff also, so go for it.
1207590	1209910	All right, brute force.
1212070	1217270	So whenever we are thinking about brute force, we are trying to brute force the passwords.
1217770	1221490	We can try another way as well by using password spraying attack.
1221670	1226230	We can brute force the emails by using one password.
1226230	1229790	We have one password and we can try that on multiple users.
1229790	1232530	We can try to brute force in that way as well.
1232530	1238490	So whenever you are performing red teaming activities or bug hunting or something, you just need one account to perform your actions.
1238490	1241750	So this will be very handy.
1242370	1246690	Try to check if there are rate limiting controls are enabled or not.
1246950	1255950	Other than that, sometimes application is blocking your IP address whenever you are performing brute force attacks.
1255990	1259490	So you can hop on different IP addresses.
1259490	1264250	You can change your IP addresses depending on how application is blocking it.
1264250	1266830	Maybe after 15 requests or 50 requests.
1266830	1276130	And just before, let's say application is blocking IP after every 50 requests, you know, within maybe some sort of time foundation.
1276190	1280990	So you can change your IP on 49th attempt.
1280990	1282710	Accordingly, you can try that.
1284550	1292050	You can send multiple credentials in request to validate that, I mean, it is working or not.
1292130	1298930	There is a very, very good lab of web security academy, please check that.
1299890	1301270	Default credentials.
1302070	1305830	This is very, very handy in rate limiting activities.
1306490	1311250	So , I mean, almost every organisation is using enterprise products.
1311690	1314170	Go for it, check for the default credentials.
1314390	1317170	I mean, it's still working, I usually find that.
1317810	1323270	WordPress, it is one of the most popular CMS.
1323270	1335610	So there is a so-called feature in WordPress where you can use author parameter just to verify that what's the username of one.
1335670	1342070	I mean, let's say if you will enter the author's value one, it will show you the first user of that particular application.
1342230	1347210	If you will change it to two, it will show you the second user of that particular application.
1347210	1351750	It will show you the username, it will show you the posts which are done by that user.
1351750	1353970	It might show you the comments as well.
1354270	1358210	So accordingly you can enumerate user's information.
1358710	1367950	And whenever you are performing WP scan, don't perform directly without using API keys.
1367970	1374770	Please use API key, you can go to WP scan website, you can get API key, it's free of cost.
1374790	1380990	And by using that particular API key, if you will perform the WP scan, the results will be definitely different.
1382710	1392070	In secure logout management, whenever you are working on pen testing, check for these things, especially for banking applications.
1392210	1396050	For example, reuse of session, check if you can reuse that particular session.
1396050	1401930	Login to the application, logout from the application, check if you can still use the old sessions.
1402510	1405410	Close the browser for the sensitive applications.
1405410	1412030	Whenever you are closing the browser, it should dissolve the entire session at the server side.
1412430	1421770	Let's say if there is a net banking application and you are closing the browser, whenever you are again accessing the application by using new tab, it shouldn't work.
1422130	1424210	Application should ask you for the login.
1425190	1428650	Session should bound to IP address for sensitive applications.
1428790	1441890	For example, as an attacker, if I am able to get the session of my victim, but if let's say that is bound to their IP address only, I won't be able to use that.
1443770	1444830	Check for it.
1446710	1449950	Tips for red teamers and pen testers.
1450890	1454230	Go to pastebin whenever you are performing red teaming activities.
1454390	1458430	Go to pastebin, pastebin have a lot of sensitive stuff.
1458890	1462970	DHash, go for DHash, you can find the passwords of your victims.
1462970	1467130	Open bug bounty, this website is very handy.
1467130	1470950	I used it multiple times and it helped me a lot.
1470950	1478430	You can find a lot of vulnerabilities which are identified by other attackers.
1478850	1487130	And they have disclosed those vulnerabilities publicly because the vendor is not entertaining them.
1487830	1490630	So you can use those vulnerabilities.
1490630	1504210	My first bug, I found it in Apple, I found account takeover or authentication bypass basically, I will call it as authentication bypass.
1504830	1506870	So that was my first bug in Apple.
1512500	1519600	So this was session puzzling, which I explained in the earlier stage.
1519700	1528000	So I was able to get the session variable, which was active for post-login modules as well.
1528920	1530420	In the pre-login stage.
1531820	1540440	Here I am on login page, I'm trying application is redirecting me to the login page only.
1540440	1543260	There is a story behind that.
1543500	1546840	The domain name is instafusion.apple.com.
1547220	1554440	If I will go to that domain directly, it will redirect me to the SSO of Apple.
1554660	1557020	Based on my understanding, it is bit secure.
1557020	1559140	I haven't tested that, to be honest.
1559140	1563100	But yeah, based on my understanding, it is secure.
1564600	1575940	Then I did some sort of Google docking and I got to know that there is a subdirectory with a random string folder name and there is a login module there.
1576100	1578060	So I tried to hunt here.
1581140	1586250	I removed the login page, application is redirecting me to login again.
1586720	1588240	Here it is.
1589930	1595180	So application is asking me for a username and email address.
1595940	1600500	I provided a fake username and fake email ID.
1608080	1612880	I got an error that please try again.
1612880	1631680	But for this particular thing, when application was throwing me an error, application created a session which belongs to my email ID and they have activated it for the entire application and which was linked to the admin module.
1633600	1634160	Now
1637320	1642580	I tried to remove the login and tried to access the subdirectory.
1643160	1644000	Boom.
1650160	1651460	Thank you.
1653700	1659020	So here I was able to download the confidential details.
1659620	1663660	I have blurred a few contents because of sensitive information.
1664180	1666280	So yeah, I was able to download as well.
