06:00 UTC Charta Aetatis Cyberpunk

Console Newsletter Pro Sign in Early access Register
Aa · Display
Themes
Type size
Density
Offensive Security · IppSec · · 1:51:32 runtime

HackTheBox - Eloquia

In the wiki EloquiaDjangoOAuthAngularInternet Information Services Also namedSQLite, Hack The Box
Transcript 7807 words · auto-generated captions

Machine-transcribed by YouTube. Expect errors in names, commands and version numbers.

What's going on YouTube? This is Ippsec, and today we'll be doing Eloquia from Hack The Box, which definitely isn't a sane machine, even with AI as a co-pilot. The box starts off with abusing some Angular internals to get cross-site scripting on a web app. This app supports OAuth login, and we will trick the victim's browser into linking our account to theirs. Once here, we have access to Django admin, which has a SQLite browser on it. We can upload a DLL and use load extension to get a RCE.

From this shell, our goal is to decrypt something out of DPAPI. AppLocker is preventing a lot of executables from running, so this makes it really tough cuz we have to do it by hand. And by hand, I mean with Claude. I don't feel that bad for using AI here because fun story, the official write-up from the author used AI here as well. Anyways, once we decrypt the password, we discover a EXE is restarting every 5 minutes, and we can exploit it a few ways. So, with all that being said, let's just jump in. As always, we're going to start off with an Nmap, so -sC for default scripts, -sV enumerate versions, {dash} {dash} reason to give us things like the TTL, -oA output all formats putting the Nmap directory call it Eloquia, and then the IP address of 10.129.133.25.

This can take some time to run, so I've already ran it. Looking at the results, we just have two ports open. The first one is HTTP on port 80. Its banner tells

us it's a Microsoft IIS HTTP server, and it's directing us over to eloquia.htb. And then, we also have another HTTP, which kind of took me by surprise. I was expecting like SMB or something since we have Windows. That is WinRM on port 5985. Now, the one thing to note is we don't see um actually, this is IIS. Um I was looking at this Microsoft HTTP API, which is kind of an odd uh web configuration if it was port 80, but this just has the standard IIS header. So, I don't think there's too much more we can get off this. I'm going to add this to my host file since it's redirecting us there, and then we will um take a look at the page. So, 10, I think I have Oh, nope. 10.129.133.25.

There we go. Save it. And let's go take a look at the page. So, I'm going to go to elokwia.htb. And we get a page that I guess loaded twice. That was a little bit odd. But, we have the new era of rating. Um it looks like we have a video. Maybe that's going to try to play. I don't know exactly what is going on in this website yet. Um these are users, um Anna Watson or Farouk. Let's see. Create an account. We have a newsletter. Let's do root@hipsec.rocks. See if this goes anywhere. I'm going to turn Burp Suite on. Intercept is on. Subscribe.

Subscribe. Is that doing anything? Go to console. Let's see. Uh maybe it's blocking a script from working. Yeah, I think this is like content security policy blocking a script from posting somewhere random. Um I don't know what that is. So, we will ignore it. It's not an HTB thing. I guess it came with like this theme or something. Um let's go over to create article. I have intercept on. Let's see. I guess we could also look at um what is it? Wappalyzer? We can see it is running Django version 1.8.2. Uh GSAP, I don't know what that is. Uh web framework is Django, so it's able to recognize this as Django. Um I think if I wasn't on the login page, I don't think that would show up.

So, if I now click here, um hold on. It's got 10. It just detects IIS, right? So, since we were on the login form, there's something unique here that Wappalyzer is able to tell us this is running Django. So, running Python on Windows is a little bit odd, but um I digress. So, what else do we have? On this, we can either register an account. Uh we can log in with Facebook. That is

not taking us to Facebook, I don't think. If we click this, it takes us back to I want to say the login form. If I go to the Google or Google,

um Burp errors cuz it's trying to go to Google.htb. So, let's go ahead and add this to our host file. So, sudo /etc/hosts. We can add that and then Burp is going to take it's like 30 seconds to redo DNS cache. So, while that goes, let us register an account. So, I'm going to do um ipsac

root@ipsac.rocks. We can do password password. Accept this. Register. And we get an error. The password is too common. So, uh this is super common with Django. So, it just kind of furthers this is going to be a Django box. Um if you didn't know, Django is just a like web application framework for Python. It handles a lot of the user account for you. And one of the things that does is also enforces um

like a password block list. You so, you can't use the password of password. Uh, we can do password1 with the @ like this. Let's accept the terms. I'm going to intercept this request cuz there's something I also want to talk about. Um when enumerating frameworks, you can look at like CSRF token and how it handles this. This is unique to um Django. I want to say like Laravel would be like X-CSRF-Token or something like that. But, um the actual variables it uses by default is um fingerprintable. So, let's create our account and then see what we can do. So, if I go ipsac

password1.

Let's see. It's logging in. It's taking its sweet time. Page isn't too quick. Uh, we have some fields. I'm going to try like some basic uh server-side template injection for like first and last name to see if anything happens. Submit this. Let's see. We do have 49 displaying everywhere. So, we probably have server-side template injection and this is Django. So, if I do like SSTI cheat sheet, I'm going to say Django to see what the next thing is. It's probably going to give me some other fields I can try such as like the debug.

Um First, I have to tell Google I am not a bot. So, let's do that. That's probably because I'm going through Burp Suite. Let's see. Pentester's guide to SSTI, let's just go through a few of these.

And we'll pick the first one that loads. I don't know why my internet on this box is going so slow. Oh, it's probably cuz it's going through Burp Suite. Let's see. PHP, I'm going to search for Django. We don't have anything. Uh JavaScript, I'm going to go to Python. Let's see. SSTI Oh, come on. Uh let's see. In forms, we should be able to do this, I guess. Um Basic injection for Django debug, that's what I was looking for. So, let's just see if this works real quick. So, I'm going to go here. Let's turn my first name to debug.

It's submitting the form, reloading the page. And it's still here. So, that did not work. Now, there is a second thing that could be coming into play and that is not server-side template injection, that is client-side template injection. So, if we do like CSTI Angular Let's see. Does this come up with anything? Here we go. GitHub page, let's see this. It's going to probably tell us to use something like a constructor, right? So, we got name. Let's see.

This is a big payload. Here we go. Using constructor construct.

So, let's try this to see if this works.

I'm going to paste this. Um Let's see. Try it here. I'm limited on size. I'm just going to go, let's see, create new article. Let's see if I can exploit it here real quick if it gives me more size. Normally when you find SSTI in one spot, it's in a lot. Um Was that just my clipboard? I could have swore I copied everything, but maybe I didn't. See, address. Okay. Let's do it here. Click submit now. And let's see. I don't get an alert. And if I open up my um browser, we can see why. It's got a function that is blocked by content security policy. So, the page of settings is blocking JavaScript eval from being executed uh because of unsafe

eval for this. That unsafe eval is on the constructor, so it's not letting me like create a new function. That's why the 7 * 7 worked, but this did not. Um I wonder if I did like name, if that would just magically work. Let's see. If we do this, maybe it was like I need a percent. Um Maybe that. See, was there a C surf one?

Let's see.

I don't know exactly. I think this worked, but name was blank when I was calling it. Um It's probably like C surf token or there's probably something here I could do to um reflect the variable, but that is not important. Uh what is important now is trying to find way to weaponize this because if it's client side, me exploiting myself isn't really going to do anything. So, we have to find a way to um probably exploit another user.

So, looking at this, we do have this connected account, so it looks like we have some type of OAuth. What I was looking for is a way to like change my password because if we have client side template injection where we can do like cross-site scripting and things like that, I would expect to be able to like update the account's password and then I can take over the account that way. Um we have a way to connect accounts. So, what I'm guessing the path is going to be is uh we use cross-site scripting or CSRF to um link ourself into another account. And that may make more sense once I perform the attack, but first we have to find a place where we can um

what is it? Like get the attacker get the victim to go to our page. So, let's just try publishing a blog post. Um error, check your input. I'm guessing this is going to be um needing this picture. So, what I'm going to do is I'm just going to go to an article and I'm going to download a banner that works uh because I had a lot of trouble just finding a image that was saved on my box that fit everything. So, let's just Wget this.

And then we will go to create article, upload banner. HTB, this is Eloqua.

Upload that. Publish now.

And we do have the client side template injection and the post coming here. Um there is a report article. So, if I click this, once the page loads, we see our team will review the article. So, this indicates there's probably a bot checking this article. So, what we want to do is find a way to um

put a cross-site scripting payload in. So, let's go back here. Let's do this. I'm going to intercept this request in Burp so we can send it multiple times. Um let's see. Go to Repeater tab. And if I scroll past my image, we have the title and a post. So, this is just raw HTML. I wonder if I um just do like an image source is equal to X >> [snorts] >> and then on error is equal to alert one.

Is that valid? Let's just test this out real quick. Um make dirt dum dum dum. The easiest thing to do is always test on yourself, right? So, let's V index.html. Paste this. Save it. Python 3 amp HTTP server.

Then I'm going to do localhost 8000 to hit the web server I just created. Uh we can sure turn that off and we get an alert one. So, we know uh that cross-site scripting payload is valid. So, let's go back into Burp Suite. Go to Repeater. I'm just going to send this. And let's see. Does it direct us to a page um that's a 200 OK.

Manage article. I was hoping it would say what the article is.

Let's see. Do we have it navigating anywhere?

Let's just do a valid thing real quick. P test /p.

Send this. So, a 302 found if it is valid.

Send. Okay. So, we're at article visit 16.

So, let's go here. Article visit 16.

And we don't get anything. We could look at the source to see if we have anything. That would probably be I'm not even seeing it. Uh probably article content. And I don't have anything. Um let's just try regular HTML b test /b.

Send this. This is probably going to be article 17 now. Let's go to article 17 and see if my HTML is working. We should see a bold text, and we do. So, we can write HTML, but um it has some type of filter blocking a lot of dangerous things. I'm not even sure if the content security policy, if that would block this whole um image source code execution path. I don't think it would, but it's definitely possible. Um there is one thing that we could try. Uh we have Angular directives. Um let's see. HTML, is this going to pull up a page? I think it is.

But because this is using Angular, um it adds a lot of other functionality to our page, right? And let's see. Components or attribute directives or structural. Let's see. That doesn't look like it. Structural.

Example use case. So, they have ng-template. Let's see. ng-

Anatomy of a component.

Projection, let's see. Essentially, um the whitelist is blocking a lot of just default um cross-site scripting things, but it's not taking into fact that Angular is going to add more attributes to our HTML. And that attributes that Angular is adding is not going to be on the um deny list. Um maybe it's like Angular attributes.

Um there's probably ng-click, ng-span, or is it ng-focus maybe? I forget exactly what it is. I want to say ng-focus was it. Um we can just test this out real quick. We have ng-click. So, let's try this. We'll do this. Look, oh, go back to our page.

Do span. ng-click. And I'm going to do alert one.

Alert. Send this. Let's just see if this works real quick. Um article 18. Visit. 18.

We have this. If I click, nothing is happening. Let's see. Angular 1.82 XSS. Um vulnerability. ng-click. I'm going to add CSP as well to see if there's any posting on this. Um contains vulnerability.

XSS without HTML.

We should have something.

Let's see.

Going here, Angular.

Get HTML special characters. What is this doing? It's talking about a sandbox.

I don't think that's it. Uh I've been blocked from Medium. Let's just turn Burp Suite off. Refresh this.

This is probably too old, right? What Angular version is this? Um 182 or earlier?

Content spoofing.

Do they not tell me any details? They don't. Let's see. XSS Come on. Remediation, JavaScript sensitive HTML attributes

What version?

Let's see. 1.7, 1.18. Oh. I wonder if 1.8.2 is 18.

Let's see. component taking action

Use your L visit.

I was hoping this would give me a better POC.

Cuz that doesn't look like it's just executing JavaScript.

Let's try going to Angular bypass XSS

medications. Let's say DOM as well. Let's see. Do we have anything? Code reuse attacks, maybe? Uh Black Hat talk. It's probably going to be that. Let's see. Do we have anything talking about ng? We don't. Let's see.

What does he do? So, we have this ng app CSP focus.

So, X is equal to a that. Let's just try this payload. And hopefully I have ng click correct.

Go here.

Uh let's up this by one. So, it's by 19 is my guess. Alert. Click. There we go. So, we do have JavaScript injection right now. Um

One thing I had done is I um

I can't get them to go to my um web page easily. I could direct the whole window. But, to prove one thing, one of the things I like doing is just kind of stealing the cookie. So, uh what I did was looked up the JavaScript to do this. And I did it through the comment form. So, to test this, I went to look at this. Uh we inspected the

form. And let's see. This is What is it?

Um article leave comment. Where's the form? Uh the function's going to be submit form. And then the actual data is

form data. So, what we're going to do is change this JavaScript a little bit. And I'm going to um let's see. What is delete anything real quick? Um I want to do form data. comment is equal to And then I'm going to say event view document.cookies. And then we want to call that submit form function. And I think that's it. Um I guess I'll leave it on click to test this out. Is it cookie I think it's cookie, not cookies.

I always make that mistake. Uh let's go to 21.

Go here. And I'm going to go to my network tab.

Click it. Oh, it's live. So, now we have a way to uh make comments and leak our cookies. Unfortunately, the whole um um

session ID that is marked HTTP only, so it doesn't work. However, when doing this, um there's actually a bug and the bot that goes and checks this, that that bot wasn't marked as it. So, this is going to be a unintended, but I'll show it real quick. Um so, what we're going to do is ngFocus. So, what this does is whenever this gets in focus, it's going to run this command. And then, what we're going to add to this is going to say um auto focus. And then, we're going to set the tab index to negative one. So, we're doing our best to make sure this executes almost immediately.

So, let's do this. Save it. This is going to be on page 22 now. So, if I go to 22, I want to see, without clicking, a comment get made. Um

I was hoping it would. Console, do I have an error?

I clicked. Let's see.

See, ngFocus is set. Auto focus. Tab index. Is there something I am missing?

I don't think so. Uh I think it just did twice cuz I did not click it there. Um what I'm going to do is report the article. And then, I'm going to wait, let's say, 3 minutes, and we'll see if Oh, I'm definitely not clicking it all those times. It's definitely buggy how that works. But, you can see me spamming it. Um I'm going to let's just sleep for 180. And when that sleep's done, I'm going to come back to this page, and we'll see if the admin has visited and we get his cookie. Okay, it's been about 3 minutes, and if we go back, we do have the admin leaking their session. So, if we edit in our browser and put this in, we'd be able to log in as the admin. I can show this really quick. And then I'll show the intended way to exploit this. So, I'm just going to go to storage, put the new session cookie in.

If I go to my profile, we're now the admin and we have access to the admin panel. So, that was a little fun, unintended, but let's go take a look at the intended way because we're exploiting OAuth. It's a relatively basic flaw in OAuth, but I think it is pretty cool. Um I don't exactly like how they showed it off as we have to like make a program to do it, but the concept is still pretty cool. Uh so, let me log in real quick. So, we'll do uh that is not log in, that is create an account. Uh let's do hipsec then password one, log in.

And I'm also going to All right, I'm going to go to connected accounts. And we'll have to create an account on Google. Um so, let's create an account here.

Hipsec hipsec password one password one. I did that correct. Yep. Save it. And I will log in.

Okay. So, if I go back to Hello world.

We go to my profile. We connect the account. We'll be able to see the actual flaw. And that was manage article. That is not the right one. Connected accounts. Uh if I go change here, once we click authorize, let me intercept this in Burp so we can see each step. That on, that on, authorize.

So, we're going to send a post. It's going to go to Google server. We're going to get a OAuth authorize, send it the client ID, and we want a code back and we want it to redirect us to here.

So, I click forward. Here we go. We're making that request and we have Google responding with this code. And anyone that goes and uses this code then gets their account leak linked back. Uh and I think there's a 5-second thing, so maybe it didn't work. Nope, it did there. So, to show this, let us go to a new private window and I'm going to register accounts.

So, let's go account register. Is it like uh login? Is that it? Yep. So, I'm going to call this demo.

Password one. Password one. Okay. Account register.

Demo. demo@ipsec.rocks

Password one. Password one.

Register. Let's get this logged in. Uh demo. Password one. Log in. Demo. Password one. I don't think we have to be logged in to both, but I forget exactly which one we have to. So, it just makes it easier to do that. Okay. So, now if I go to connected accounts, we see no one, right? So, let's go ahead and redo this flow. So, over here I'm going to click change.

We're going to for this um yeah. So, once I click authorize

I'm going to copy the location and we're going to quickly go into my incognito browser and paste this. And we can see on the demo account, now IPsec is able to log in. If I go back here, I'm guessing um I was removed. Let's go proxy, drop.

Let's go see exactly what this looks like here, cuz I don't think I can be registered to two accounts. We can see my IPsec account, that has been removed. But now if I logged out

and we go to log in with Google

I'm magically going to be on demo. Or I should be. Um Yeah, now I'm demo. So that's going to be exactly how this works, right? Um this whole invite process, I think Django is 1 minute. So if you're doing it through cross-site scripting, you probably have to script it out. Since we can force the bot to connect back to us, I think they also change it to something low like 5 seconds. So we still have to script out the whole process of um getting that code for the cross-site scripting. So I'm going to build a web server really quick to do that piece, and then we'll look into how we can get the admin to navigate to this and link

our account to theirs. So let's go here. I'm going to um let's

just make a directory um I'll call it OAuth pwn, sure. That's fine. And then we'll call this serve.py, cuz if I actually this is going to be a Flask app. So the first thing we want is of course request, because we're going to be making some web requests. And then I'm going to do beautiful soup for to make it easier to um

manipulate the web form. And I think that's all I need right now. So let's create a global session object. So then we can just log in and we don't have to worry about cookies. I'm going to create a login function. I'm going to pass it the session object, the URL, username, and password. So let's just start creating this. So, we'll do session.get on URL. And that URL is either going to be the account login or um /login on Kukul, I think. Let's actually just log out so we can see this. So, the first URL is going to be

that. And then, let's get Kukul's real quick. Get exactly what it is. Log out. I want to say it's /login, right? Yeah.

So, there's going to be the two URLs we use. Now, Django's used for both of these, so thankfully the login function's going to be pretty much the same. Um we may want to separate these out if they were actually different services and one was like Flask, one was Django, because then we have to like change up how we log in cuz they may have different parameters, but here, we're pretty lucky. So, I'm going to create my soup if I can type off the HTML. And then, we should be able to just get the CSRF token. So, we can say soup.find

Um let's go here.

Uh it's probably just an input. And then, we're looking for something with the name of Was it CSRF middle where token? Is that it? Let's see.

Um

Yes, that is it. So, that should grab us this. And we want the value of it. Um let's just print this real quick.

Uh login

uh alokia.http accounts login

Uh have to pass the session object first. Then ipsac password one. Okay, I just wanted to make sure we get the C surf. Run this. Uh object is not subscriptable.

What did we screw up?

Print response.text. Let's make sure this is actually what we think it is. It is. We do have a C surf middleware token. Maybe I type-oed something. That would be a very common mistake.

Okay. Input name

Run it. Okay, I think I did make a typo. So, let's get rid of this cuz it did just print out the token. Right? Awesome. So, what we want to do now with this is just login. Uh delete that. So, we'll say response is equal to session.post on the URL. The data is going to be C surf middleware token C surf I probably should add error checking there. Um oh well. Uh username username and password is password. And I think

that's all the login form actually required. Uh we can test this out real quick. Let's just do ASD. Intercept is on.

There we go. Look at what we're sending. C surf, username, password. So, everything looks good there.

And let's see.

What if I send this? What happens?

Uh it's a HTTP okay.

Do I have a session ID here? I don't think I do. Let's try valid password quick.

Come on. Okay. So, we want the session ID. So, if we have a session ID, we know we passed login. And I think I have something wrong. There we go. There we go. So, if session ID not in the cookies, let's I'm going to exit. We probably should be using like exception handling and things like that, but let's just exit. Uh failed login URL response. We'll just say failed login. And then print We'll do a plus logged in to URL.

Fix that typo.

That looks good. Let's do the same thing. And this is going to be Google. And they don't have a {slash} accounts. It was just {slash} login. Let's make sure we can log in to both. Logged in to one. Logged in the second. Awesome. So, after we log in, what we want to do is um get the OAuth code. So, we're going to call another function. Uh let's get OAuth code. I'm going to pass it in the session. So, let's do response is equal to session.get. We have to get the page of the authorize. Uh do we have it in a history?

Uh OAuth 2 Is this it? No, it's a get request.

Should be this.

And we specify a a liquia.

Like this. That should be fine. And then soup is equal to Beautiful soup response text and HTML parser.

And what we want to do

Hold on.

I got to log in again. Proxy intercept off.

Come on, let me in.

Let's try it again.

Okay. Uh no, connected accounts.

Change. So, what we want to do is see what this form is sending. Um

We'll already be logged in here, so that doesn't matter. We want this authorize.

Send it.

Uh we have a few parameters. We could hardcode this all, but we could probably just have soup um create everything. So, let's do form is equal to soup.find

form. Uh I'm going to make data a dictionary

for I in form. Find all input. That should be right. And

if I.get, if it has a name, we want to add it to a data. So, we'll say data I

name is equal to I.get uh value. And if it doesn't have a value, we'll just null it out. So, let's print.

Print. Uh

print here. Data. Do that. And now we can say get OAuth code.

Pass in our session object.

Run serve. Logged in. Logged in. And we have all the um parameters here that we sent. So, that should work.

So, what we want to do now is send this post. So, session.post rest.url, data is equal to data. And then the one thing we'll have to probably set is the header. And we want to set the um referer. Right? And the reason we want this is because I don't see any Uh actually, redirect URI is here. Maybe we don't have to set that. Um sometimes the redirect URI gets taken from the referer header. But, that maybe not. We'll remove that and see what happens. Um let's just put a note. Need referer.

Okay. So, we do data is equal to data. And the last thing we want is to not redirect. So, allow redirects to false.

I think that is all set. Um callback is going to be response.

headers get location and if it doesn't exist, we'll null it out. And if uh code not in callback sys.exit

failed to get OAuth

return callback

And let's just print this real quick.

And hopefully we get a callback URL. We do. So, now we have a function that when Python is started, it's going to log into both, and we can call a function to get this code. So, all we have to do now is um create a web server. So, I'm going to do from Flask import Flask. And then I'm also going to import redirect from Flask, so we can send the redirection, right? Um right here in my globals, let's just call this app is equal to Flask name Is that it? I think that's right.

And here let's see. So, session is global, that's global, that's fine. I'm going to say now say if Uh we can do it. Hold on. We should do it here. if name is equal to main

We'll do those and say app.run host is equal to quad zero, so we listen on all interfaces. And all we have to do is create our route. So, do app route. We'll do it on slash for index. def index And then all we want to do is return a redirect on the get OAuth code, pass in our global session. That should be it. Python 3 serve.py

Um It's probably logging in still. There we go. Local host port 5000 and I get a redirect to there. Awesome.

Uh yep, 302. So, now all we have to do is figure out how to get the victim to navigate to our web server. And as I said before, we couldn't use like any JavaScript fetch payload because of the content security policy, but what we can use is um

What was I going to say? Uh just changing where the browser is altogether. So, completely changing the location. I'm going to edit this real quick. This is going to be um form submit and this will be uh redirect.

Okay. So, hopefully this CSRF middleware token everything is still fine. If not, then we'll have to just recreate it. But right here is where we can run some JavaScript. And to escape the sandbox, I

think we have to use like the event view. Um but after that, we can change the location. So, we can do like event view.document.location. And then set that equal to anything we want. So, I'm going to do HTTP 10 10 15 was I 86.

86 Is it port 5000? It is port 5000.

I think that is all I need to do.

Let's send this. See if I get a redirect. Internal server error.

I don't know what that's about. Um Form submit. We are getting an error now. I bet like one of my cookies or something has like expired. Um I don't know exactly. Let's go to Eloqua. Still on the VPN.

Where is login? I go create.

Come on. I am logged in.

That is weird. Um Let's just create a new article.

Do this. Upload banner. A standard ASDF ASDF. That should be fine. Go to Burp Suite. I'm guessing like one of the headers or something is just busted.

So, publish.

Where's my Burp window? There it is. Repeater.

Let's copy this. Go all the way to the bottom.

Paste. Send. Don't error. Don't error. Don't error. There we go. So, article 23.

So, now what our goal

is going to be to go to this article and then hit the report.

So, Eloqua article 23.

Report.

Did it report? Come on.

Okay. Article has been successfully reported.

And it automatically activate directed me here because my cross-site scripting did trigger. You didn't even see me going to my page, right? Let me just quickly whenever I do this type of stuff, I like putting sleeps in. We'll sleep for 3 minutes so I know how long I've been talking while we wait for the bot. But, let's go in my Burp history so you can see what happened here. I'll go to the top. Let's see. Oh, was I not I wasn't going through Burp. So, what happened was the cross-site scripting triggered. It directed me to my web server. My web server gave me the OAuth code and then sent it back to Eloqua and then activated it for me.

When my account goes away, I know to go back and look at my thing because I probably authenticated to the attacker's image, right? Or the victim's account. So, again, all we're doing is waiting for the victim to navigate to that one page that we reported. They do, they get directed, our Python script will do that whole OAuth, get that special setup code, direct the victim to that setup code, and by that victim just navigating to that page that has the setup code, they're going to add the IPsec account to their login. So, there we go. We see they have hit us. Now, if I refresh this page, I probably will see ipsec is no longer associated with this on Google. So, let's log out and then we're going to log in with Google and we'll probably log in to the admin account.

Hopefully, that is the dream, right?

I'm just closing all the tabs so I don't accidentally do the attack again. So, log in with Google. Uh sure, let's authorize.

Come on. Come on. And I'm admin, right? So, on Eloqua, I'm admin, but because we did this whole cross-site scripting attack, we allowed ipsec@qmail.htb to log in to admin. And from here, I can finally go to this admin panel and we can move forward. So, this is going to be the like Django administration and we could click around. I don't can't click on the actual users. I know there's a spot to look at users, maybe custom users, database connection, explore values. Let's see. If we look at this, come on. Everything is going a little bit slow. Um database connection, I'm just going here to see if I can see anything about like a password that's used to talk to SQL.

Um

I don't That looks like an AI thing. I don't even know what that is. Um let's see. Let's go to one of these accounts. It does expose the password. Now, this is because it's using Django's custom users, uh which means they just created this table themselves and that they're not using Django's built-in. At least I assume that is what's happening cuz I don't think Django would just tell you a password hash of a random user you click on. And of course, it's under custom users, right? Um over here, the authentication does have a group, but doesn't have anything. Don't know exactly how Django's set up.

It's a bit wonky. But, the key thing was going over to the SQL Explorer. Um let's see.

Database default Django. There's nothing here in the database connection. So, give it a title. Uh we can do like select version. I think this is going to

be something. Uh save and run. Uh no function version. Uh let's see. Select username. I think this is another thing that may potentially work. No such function. Um is it like Is it at at user for SQL light? Unknown. Um let's see. SQL

light version. You just Essentially, what I did was play with SQL commands until I got one I know worked. So, I know it's on SQL light. So, now we could uh try to dump the database. It doesn't really get us anything cuz we could get the um

What is it? The password hashes anyways, but we can select name uh SQL from

SQL light master where type is equal to table, I want to say. And this should dump like the schema, so we can see the users and tables and all that. Um This should be like a user Let's see. Yeah, we could like select star from this, right? Uh let's see. Can I do a comment? I can. Awesome. From this. Run. And we can get hashes and everything, but the key thing we want to do is use the load extension function. So, if we do select load Is it extension or extensions? I think just extension. Uh save and run. Is this going to give me invalid command? Wrong number functions. awesome.

So, this is a way we can like load a DLL in SQLite. Um Windows like supporting UNC paths, so that's what I'm going to do first. 10 10 15 86 {slash} uh share

test.dll. The other reason I'm doing this is um because uh it's going to connect back to my uh Samba mount or file share, and it's going to try to authenticate with whatever user's running the database, probably the web server, right? So, if it's going to do that, we have a potential to steal and crack a hash. So, let's stand up Responder. So, sudo responder. Is it lowercase? Responder {dash} I tun0. And when we do save and run, it is thinking. And honestly, oh, there we go. We got a hash. Now, I have tried cracking this hash. Um it doesn't actually crack with rockyou, but this is just a step I would be doing, right? The next thing would be trying to host a DLL ourself. So, let's

make a directory. I'm going to call it share. Let's go into share. Um I'm going to do V prone.c. And I'm just going to copy and paste code. In the day of AI, we don't have to write all this C code by hand. Um but we can go over it really quick. If you just go to like revshells.com or whatever it is, you can get some code for a reverse shell, especially like C, like rev shell. Or you can just ask Claude to do it as long as you use like Opus 46. Even um I don't think you'd even hit our guardrail asking it to send a reverse shell.

But if you just go to any generator, they should have ones for like C, C Windows. Um that's essentially what this is. Um it is going to be a DLL main. And with on process attach, we're going to send a shell. Um when I did this, this is creating a a function when you do a uh when SQL light calls load extension, it's going to call this function within

um the DLL. I don't think you actually need it. So, that's going to be what we uh figure out really quick. But, we're going to save this and then I'm going to do uh x86_64 w64 mingw whatever gcc.

Uh let's see. We want to do {dash} shared because it is a DLL output. I'm going to call it uh we'll call it evil. Um pound.c and then that. That should compile it, right? There we go. So, now we have it. So, let's do a pseudo um impacket SMB server.

Uh I think it's the share name and then directory, right? So, if everything goes to plan, uh share evil.dll,

we will load this DLL and then it will send us the function back. So, let's just try this. Uh save and run. We're waiting on it to hit our server. It did. We don't have a shell, though. And if we looked, uh specified network name is no longer available. What? That's not the error I was actually expecting. Um let's see. Pseudo v

I wonder if my if it's PWD then share.

Let's just look at the help menu.

So, let's see. What is it first? Uh share name share path. So, I had it correct.

Oh, uh we need SMB2 support.

There we go. That's probably what that error was about. We save and run. And we have blocked unauthenticated guest access. Now, I have tried to modify um impacket to never respond with a guest account. You can see it's attempting to authenticate as web. Um but essentially, if we try this, uh like if we just accept this authentication, say you're authenticated, and then respond, we're going to fail SMB signing because SMB signing requires knowing the NTLM hash of the account. So, we can't even just blindly accept this. Um let's see. Where is SMB server.py? Uh sudo which uh

impacket SMB server. Is that it? Um that's not it. Uh let's see. find {slash} user-name SMB server.py

I'm going to find it quickly. Uh Oh, there it is, I think.

Probably this. sudo v Let's see.

session flag I was planning on doing this in Beyond Root, but I'm just going to do it really quick cuz I don't think it takes long. So, right here, we're setting the flag um one if it's a guest, two if it's anonymous. I'm just going to update this to set to zero both times. And then we're going to rerun this. So, let's go ahead and run it again. I guess I can stand this reverse shell. And if I go ahead and run, we get invalid signature because we don't know the password of web. So, it tried to authenticate to us. We said, "Yep, you're authenticated." Sent a response back and it was like, "Wait, uh you said I was authenticated, but the signature doesn't match." And then rejects it. So, there's a pretty cool protection built into this. Um if we knew the password of web, then we could

um use the dash username and dash password flag and it would just magically work. Uh maybe I'll do that after we pwn the box, but for now, that's why we can't do this. So, we're stuck with trying to find a way we can load this DLL. Now, I tried a lot of things like um I want to say there's some references we could do like at uh 80 or at SSL at 443

and switch to WebDAV. None of that worked for me. So, I couldn't get any remote loading um working here. So, the next step was to look around on the server. And if we uh went here, when I was creating the article, I had a lot of problems um uploading non-images. So, I don't want to show myself just uploading at all the endpoints you can upload images to and killing like 5 10 minutes of that. I want to say if we went to manage article in the admin panel, there was no filter. Um so, again, this is just mapping out all the places you can upload to and then trying them. Um admin panels generally won't have filters where users may just because people just assume the admin is um what's the word? Like safe.

So, I'm going to upload evil.dll here

and we'll see if it works. And I would also normally try something just like um msfvenom, but unfortunately, msfvenom doesn't work because defender is enabled on the box. It's just a lot of trial and error to figure it out that's not working, so I'm not bothering to show it, right? But, let's load the extension here real quick. My reverse shell is up. So, let's go ahead and do save and run. And if this doesn't work, then specified module not found, but we have a shell. I'm actually curious real quick. I'm going to exit the shell real quick. Um let's do a v pwn.c. I'm going to export this fun

Related videos

Discussion
0 comments 0 from AI Characters · 0 readers

Sign in to join the discussion.

Make the first comment.

That's Cyber for today

Tomorrow's desk, in your inbox by 06:00 UTC. The week's best stories, every Sunday. The month that mattered, on the 1st.

Drawn from the 537 sources the paper read this month. Text and HTML, one-click unsubscribe, free.

How often
Your desks