It is my pleasure to introduce Vikas to the stage. Let's give him a round of applause. Hello. I hope you can hear me. Thanks for the warm welcome. So welcome to the talk and I hope you are having a good time so far. So my topic for today is authentication bypass and account takeovers. So this talk is for people who are in pentesting, who are doing red teaming activities and who are in bug bounty hunting. Other than that, if you are a student or new to this field, this is for you as well. So I hope you will enjoy it. All right. So the agenda for today's talk is I have divided it in three different phases. 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. The phase two is techniques and vulnerabilities, which I personally use to take all the accounts and bypass the authentications during my entire career. I mean, I have eight years of experience and I have used these techniques during the pentesting activities, red teaming activities and bug bounty hunting. The third phase is I identified account takeover or authentication bypassing Apple. I will disclose that. A little bit about myself. My name is Vikas Khanna. I am a technical specialist at Privasec. My key focus is on AppSec, web applications, API security. Whenever I'm not working on my professional stuff, I am a bit active on bug bounty hunting. I got acknowledgments from companies like Google, Microsoft, Apple and many more. Other than that, I have contributed to the community. I have contributed to OWASP, WSTG and OWASP www community. Other than that, I have a few CVs from Oracle and IBM for reporting them issues in their enterprise products. All right. So what is authentication? Basically authentication is a process to verify a user or a system that they are what they are claiming to be by verifying their credentials in terms of their user names, password, digital signatures and many more things. 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. So that is why authentication is very crucial. Okay. So whenever we are hunting for authentication bypass and account takeovers, these are the abusable vectors or functionalities where you can focus on. Basically I have identified issues in these features, these functionalities, but this bug is not limited to these features only. I mean you can explore. But this is based on my experience. Okay. Real-time abuse vectors like vulnerabilities and techniques which you can use basically to take over the accounts and bypass those indications. All right. First vulnerability is session puzzling. What is session puzzling? 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. Basically it's in pre-login stage but you can access post-login modules as well. All right. So the example for this is forgot password functionality. 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, application will redirect you to another page where you can enter the new password and change the password. 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. But that 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. So this issue I have identified in Apple and I will show in the later slides. All right. Other vulnerability session fixation. As name suggests that in this vulnerability you can fix the session in pre-login stage. Basically the pre-login and post-login session variables value will remain same. It will be just the state of the session token which will become active or deactive. All right. So there are two ways we can use this vulnerability. One is whenever your victim is in the remote location. So how you can leverage that? 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. All right. 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. When victim will enter the credentials, the session ID will become in an active state. Since you are the one, you are the attacker, you have the session ID, you can use it on your machine and you can log in to the victim's account directly. You don't have to enter the passwords. So that's how you can bypass the authentication and take over the accounts. This is when your victim is remote. 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. So what you can do, you can go to that machine, you can copy the cookies. Since pre-login and post-login cookie will be 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. All right. The other is access control checks. 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. So how you can take over the accounts. For example, application performing some sort of sensitive activities like change password, update profiles by just checking the user's ID. Sometimes it's in even hidden parameters. You can use tools like client side proxy tool like Bob suit 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. The other is privilege escalations. Let's say if you are performing gray box assessments as a pen tester. So you will be aware with admin level modules as well and non-privileged user or non-admin users modules as well. So you can log in into the least privileged user account and you can try to access the admin account. And if the application is vulnerable to access controls and privilege escalations, you can access the admin level modules. 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. You can deactivate their accounts. You can change their passwords. You can block them. Depending on the application's functionality, you can do a number of things. Other thing is forced browsing. Forced browsing is something when you are forcefully trying to access post authentication modules by just hitting them without providing any credentials. If there is access control bug, you will be able to access the post login modules as well. And let's say there are configuration files which are not linked with the application but are still present in the server. So you can access those configuration files and it will share, it will disclose a lot of sensitive information depending on what kind of configuration file is there. All right. Next is password reset link hijacking or poisoning by using host header injection. So let me explain what is host header injection and how it works first. Then we will dig into how we can abuse it. So whenever you are hitting an application, application verifies, okay, what's the value of host header, its origin, and accordingly application will fetch the responses from that particular application server and assign to you the resources. So whenever you are having redirection, 301, 302, you can use host header vulnerability. 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. How you can use it to take over the accounts? 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 Bubsuit and you can change the host value to the domain which you can control. All right. So here 0xnoob is, for example, my domain. I'm an attacker. All right. So I can enter my victim's email ID, I can capture the request, and I can change the host header value to 0xnoob. So what application will do? How forgot password functionality works? Application will send you a reset token link to your email ID, you can click on that and update the password. 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. 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. 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. Since it's still in the active state, because victim haven't used it on legitimate application yet. 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. You can enter the credentials, and you can change the credentials of your victim. That's how you can take over the accounts. JS files. A lot of people usually don't get into the JS files. They don't bother about it. 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 that. So you can find API keys, you can find credentials, you can even find the sensitive API endpoints. PHP type juggling. Give me a moment. So type juggling is a feature of PHP. What does it mean? So it's a functionality of PHP where you can have a lot of different parameters, where you don't have to define the data types. PHP will do it for you. Whenever PHP will perform any operations or comparisons on the variables or parameters, PHP will convert the data type accordingly and perform the action. For example, the first parameter is number 1, which is a string, 10 is in double quotes. The second parameter is number 2, which is 5, which is integer. And in third parameter, we are performing operation, additional operation. So whenever we are performing addition, PHP will convert string, which is 10, to an integer and will perform the addition operation. So the result will be 15. 10 plus 5 is 15. So the other thing is comparison. Whenever PHP will perform a comparison by using 2 times equals 2. So what PHP will do, first parameter here is integer, second is string. So the second parameter's value is 10 abc, which is a string. Whenever you will perform a comparison operation here, PHP will convert that string 10 abc to 10, which will become integer. And then PHP will perform the action accordingly. So 10 is equal to 10, so the result will be equals. How we can leverage it to take over the accounts. So let's say there is a value of parameter which don't have the integer. 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. So for example, the admin's password is not having integer value, having a string only. So as an attacker, you can mention zero in the password. PHP will compare it with admin password. Admin password is a string. PHP will convert admin's password to zero and zero is equal to zero will become a true statement. That's how you can bypass the authentication. But there is a prerequisite. It should be JSON or serialized object. Then only you will be able to perform this attack. CSRF, let's say if in the application CSRF tokens are missing and there is no CSRF protection and there is a module where you can update the mobile number, email ID, you can craft a HTML page and send it to your victim. If that victim is logged in into their account, you can literally update their mobile numbers and email address. Once you will be able to do that, you can request for forward password by entering the email or mobile number which you have mentioned during the HTML page creation. Then you can take over their accounts because application will send the OTPs or password reset links to their phone number and email ID which belongs to the victim's account. Let's say if there is a forward 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. From there you can take over their accounts. HTTP parameter pollution. It's a vulnerability where you can mention multiple parameters with the same name but the values will be different and the application will perform the action on the basis of that. So let's say there is a forward password functionality and you can mention maybe you can use that one parameter for twice, for two times and mention the victim's email ID plus your own email ID. So if the application is vulnerable, application will send password reset token to both the email IDs. But it will be activated for one account only. Depending on how application is doing that. Maybe it is validating the first parameter or second parameter. That you have to figure out. It depends on different applications. 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. You can try this on reset password, update password, wherever you are receiving OTPs you can try that vulnerability. Authentication bypasses by using response manipulation. So a few applications are validating the previous response and then perform the next action. So let's say the response is on the basis of true or false. If you have provided the right credentials, application is throwing you the true response. And if you have provided the wrong credentials, application will throw the false response. So you can change that to true and you can perform the next action. You can bypass. Accordingly, you can manipulate the status codes. If application is throwing 400 or something for wrong credentials and throwing 200 OK for right credentials, you can try to manipulate that. Two-factor authentication or OTP, you can break that. How? So whenever you are performing pen testing specially, you can use these things. You can check for the integrity validation of OTPs. For example, I can send OTP to my mobile number and send OTP to my victim's mobile number. So these two OTPs are in active state now. Because neither I used nor my victim used it for now. So what can I do? Since both the OTPs are in active state, I can check the integrity. I can try my OTP on my victim's account just to validate that application is checking the integrity of the OTP or not. And trust me, it's still working. Reusability of OTPs, you can try to reuse the OTPs. And the third one is I found it in one of the most popular banks. So they were disclosing the OTPs in the responses. So I mean, go for it, check for responses as well. Master OTPs, I found it in one of the net banking applications. The master OTP was six times zeros. So you can log into any account by using six times zero. I mean, you can try for other stuff also. So go for it. All right. Brute force. So whenever we are thinking about brute force, we are trying to brute force the passwords. We can try another way as well by using password spraying attack. We can brute force the emails by using one password. We have one password and we can try that on multiple users. We can try to brute force in that way as well. So whenever you are performing red teaming activities or bug hunting or something, you just need one account to perform your actions. So this will be very handy. Try to check if there are rate limiting controls are enabled or not. Other than that, sometimes application is blocking your IP address whenever you are performing brute force attacks. So you can hop on different IP addresses. You can change your IP addresses depending on how application is blocking it. Maybe after 15 requests or 50 requests. And just before less application is blocking IP after every 50 requests. You know, within maybe some sort of time foundation. So you can change your IP on 49th attempt. Accordingly, you can try that. You can send multiple credentials in request to validate that, I mean, it is working or not. There is a very, very good lab of web security academy. Please check that. Default credentials. If you are, okay, this is very, very handy in red teaming activities. So, I mean, almost every organization is using enterprise products. Go for it. Check for the default credentials. I mean, it's still working. I usually find that. WordPress. It is one of the most popular CMS. So there is a so-called feature in WordPress where you can use author parameter just to verify that what's the user name of one. 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. If you will change it to two, it will show you the second user of that particular application. It will show you the user name. It will show you the posts which are done by that user. It might show you the comments as well. So accordingly, you can, you know, enumerate user's information. And whenever you are performing WP scan, don't perform directly from the, you know, without using API keys. Please use API key. You can go to WP scan website. You can get API key. It's free of cost. And by using that particular API key, if you will perform the WP scan, the results will be definitely different. In secure logout management, whenever you are working on pen testing, check for these things, especially for banking applications. For example, reuse of session. Check if you can reuse that particular session. Login to the application, logout from the application. Check if you can still use the old sessions. Close the browser for the sensitive applications. Whenever you are closing the browser, it should, you know, dissolve the entire session at the server side. 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. Application should ask you for the login. Session should bound to IP address for sensitive applications. For example, as an attacker, if I am able to get the session of my victim, okay, but if that is bound to their IP address only, I won't be able to use that. Check for it. All right. So tips for red teamers and pen testers. Go to pastebin whenever you are performing red teaming activities. Go to pastebin. Pastebin have a lot of sensitive stuff. DHash, go for DHash. I mean, you can find the passwords of your victims. Open bug bounty. So this website is very handy. I use it multiple times and it helped me a lot. So you can find a lot of vulnerabilities which are identified by other attackers. All right. And they have disclosed those vulnerabilities publicly because the vendor is not entertaining them. All right. So you can use those vulnerabilities. My first bug, I found it in Apple. I found account takeover or authentication bypass basically. I will call it authentication bypass. So that was my first bug in Apple. So this was session puzzling which I explained in the earlier stage. So I was able to get the session variable which was active for post-login modules as well in the pre-login stage. So here I am on login page. I'm trying. Okay. Application is redirecting me to the login page only. There is a story behind that. So the domain name is InstaVision.Apple.com. If I will go to that domain directly, it will redirect me to the SSO of Apple. Based on my understanding it is a bit secure. I haven't tested that to be honest. But based on my understanding it is secure. So then I did some sort of Google docking and I got to know that there is a sub-directory with a random string folder name and there is a login module there. So I tried to hunt here. I removed the login page. Application is redirecting me to login again. Here it is. So application is asking me for a username and password. So I will say username and e-mail address. I provided a fake username and fake e-mail ID. Okay. I got an error. Please try again. But for this particular thing, when application was throwing me an error, application created a session which belongs to my e-mail ID and they have activated it for the entire application. And which was linked to the admin module. Now I tried to remove the login and try to access the sub-directory. Boom. Thank you. So here I was able to download the confidential details. I have blurred a few contents because of sensitive information. So yeah, I was able to download as well. Okay. Let's discuss if you have any questions. Yeah, please. So WP scan, if you will use it without API key, it will definitely give you results. But with API keys, I used it in some sort of CTS and even during my red teaming activities, it will give you extra privileges, extra features to use that. So by using that extra privileges, you can get more information. Sorry? No, no, no. You can go to WP scan website and you can create a custom key for yourself only. So that will be linked with your account. Yeah, please. Sorry? Yeah, please. Yeah, it is there. Yeah. No, so we were not discussing about traditional brute force. We were discussing about how you can, you know, if there is still, there is brute force protection, how you can bypass it. So we were discussing about bypasses. Yeah. Please. Obviously, I'm still exploring that, that particular things. So yeah. But yeah, when it question, I mean, I look into it. I'll definitely look into it. Thank you so much. Excuse me. Last thing. I'm still working on authentication bypasses stuff. And if someone from you guys is working on authentication bypasses, feel free to reach out to me. I will be more than happy to collaborate and, you know, work more on it. Thank you so much.