Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable login page #53

Closed
TeefHennessy opened this issue Jan 12, 2016 · 20 comments
Closed

Disable login page #53

TeefHennessy opened this issue Jan 12, 2016 · 20 comments

Comments

@TeefHennessy
Copy link

Hi everyone !

First of all, thanks for creating this great learning tool :) I've been playing with it for some time and had good time.

I'd like to use DVWA to learn some tools too. I'm able to access DVWA (which is installed on VM machine) externally, that is from other VM machines and for manual learning it works fine. However when I try to use for example some SQLi tools (jsql for example) and I'm targeting SQLI module I get response that it's not possible although security is set to low. I'm guessing the problem may be first login page - correct me if I'm wrong.

Is there a way to disable logging in requirement to make all labs "public" ?

Thanks in advance :)

@digininja
Copy link
Owner

If that is the problem then all you need to do is to log in manually in a
browser and take to cookie and tell whatever tool you are using to send
that with the requests. I don't know jsql but sqlmap works like that.

Robin
On 12 Jan 2016 06:15, "TeefHennessy" notifications@github.com wrote:

Hi everyone !

First of all, thanks for creating this great learning tool :) I've been
playing with it for some time and had good time

I'd like to use DVWA to learn some tools too I'm able to access DVWA
(which is installed on VM machine) externally, that is from other VM
machines and for manual learning it works fine However when I try to use
for example some SQLi tools (jsql for example) and I'm targeting SQLI
module I get response that it's not possible although security is set to
low I'm guessing the problem may be first login page - correct me if I'm
wrong

Is there a way to disable logging in requirement to make all labs "public"
?

Thanks in advance :)


Reply to this email directly or view it on GitHub
#53.

@TeefHennessy
Copy link
Author

Thank you for response digininja,

However jsql was just an example, I don't think I can tell it to use cookie and there are many more tools that I'd like to try. While workaround with cookie is good idea, this doesn't solve issue.

Does anyone knows how to disable login functionality ?

@digininja
Copy link
Owner

Any tools worth using will allow you to pass extra parameters, usually
cookies, along with them. If they don't then why not have a look at the
code and learn how to add the feature.

On 13 January 2016 at 14:38, TeefHennessy notifications@github.com wrote:

Thank you for response digininja,

However jsql was just an example, I don't think I can tell it to use
cookie and there are many more tools that I'd like to try. While workaround
with cookie is good idea, this doesn't solve issue.

Does anyone knows how to disable login functionality ?


Reply to this email directly or view it on GitHub
#53 (comment).

@g0tmi1k
Copy link
Contributor

g0tmi1k commented Jan 13, 2016

@TeefHennessy
There is no simple way of disabling the login. You would need to dig about in the code and edit a few lines.

Any 'good' tool would allow you to set a cookie value (or add a custom header field). All you need to put in is the session ID from the cookie in the request (after being logged in). I don't think I know of a single tool that doesn't support cookies in a request...
....and for the record, jSQL does support it (need to press the arrow down on the right hand side):
http://i.imgur.com/TtPmVt4.png

@TeefHennessy
Copy link
Author

Alright, thanks everyone for help

@ron190
Copy link

ron190 commented May 16, 2016

As @g0tmi1k stated, jSQL accepts also cookies. In older version there is a dedicated field for cookie and since jSQL v0.74 cookies are merged in the Header field (e.g Cookie:key=value).

What is usually done when cookie is required is that you log in manually into the application with your browser and debugger (F12 in Firefox), and you read the header string similar to PHPSESSID=eb...9d, it's your current active user's session ID.

Then you copy this full key=value in the cookie field of your security tool in order to connect to the application as the current active user. e.g in jSQL v0.74 : Cookie:PHPSESSID=eb...9d

@adamziaja
Copy link

Most easy is probably change line https://github.com/ethicalhack3r/DVWA/blob/master/login.php#L35 to if( ( $result && mysql_num_rows( $result ) == 1 ) || true ) {

@uf0o
Copy link

uf0o commented Jan 17, 2019

to me makes more sense to change https://github.com/ethicalhack3r/DVWA/blob/7ab2e557135d4658b000517f4e49b00b3027812b/index.php#L6
to
dvwaPageStartup( array( 'unauthenticated', 'phpids' ) );

@digininja
Copy link
Owner

You realise you've dug up a 3 year old issue?

To me it makes more sense to learn how to use the tools correctly. Why dumb down your learning environments when you could instead increase your own skills.

@uf0o
Copy link

uf0o commented Jan 17, 2019

why make assumpions without any context? :)
I needed a quick way to disable the login page since I have adopted DVWA to banchmark automated vulnerability scanners that lack any HTTP/POST authentication mechanism.
Hence, I left this comment for anyone else having a similar need that I am having right now.
hth

@digininja
Copy link
Owner

digininja commented Jan 17, 2019 via email

@uf0o
Copy link

uf0o commented Jan 17, 2019

appreciate your inputs :) thank you

@vulnz
Copy link

vulnz commented Feb 5, 2019

@Avanzo thank you man

@vulnz
Copy link

vulnz commented Feb 5, 2019

guys, after you did this:
dvwaPageStartup( array( 'unauthenticated', 'phpids' ) );
at DVWA/index.php

also you need to go to
dvwaPage.inc.php

function dvwaPageStartup( $pActions ) {
if( in_array( 'unauthenticated', $pActions ) ) {
if( dvwaIsLoggedIn()) {

to

function dvwaPageStartup( $pActions ) {
if( in_array( 'authenticated', $pActions ) ) {
if( !dvwaIsLoggedIn()) {

and

if( dvwaIsLoggedIn() ) {
to
if( !dvwaIsLoggedIn() ) {

change few lines.
Here is example of mine that work.
And after make mv index.php instruction.php - replace it.
Easy and sexy.

@davidvilla
Copy link

davidvilla commented Oct 29, 2019

I found some strange behavior using vulnz modifications. I got good responses with:

At index.php (line 6)
dvwaPageStartup( array( 'unauthenticated', 'phpids' ) );

At dvwa/includes/dvwaPage.inc.php (function dvwaPageStartup), comment out the first block:

//      if( in_array( 'authenticated', $pActions ) ) {
//              if( !dvwaIsLoggedIn()) {
//                      dvwaRedirect( DVWA_WEB_PAGE_TO_ROOT . 'login.php' );
//              }
//      }

Cheers

@vulnz
Copy link

vulnz commented Oct 31, 2019

Man use docker. Vulnz/dvwa and modify maybe one line of host

@davidvilla
Copy link

Thank you, I am using a modified dvwa docker image (arco/dvwa) and it works exactly I want.

@zyyae
Copy link

zyyae commented Dec 3, 2020

更改文件:\DVWA\dvwa\includes\dvwaPage.inc.php

更改代码: dvwaIsLoggedIn 函数

原始函数定义:

function dvwaIsLoggedIn() {
$dvwaSession =& dvwaSessionGrab();
return isset( $dvwaSession[ 'username' ] );
}

更改后函数定义:

function dvwaIsLoggedIn() {
$dvwaSession =& dvwaSessionGrab();
$dvwaSession[ 'username' ]='admin';
return isset( $dvwaSession[ 'username' ] );
}

it works!

@Omniwot
Copy link

Omniwot commented Mar 16, 2024

This works

I found some strange behavior using vulnz modifications. I got good responses with:

At index.php (line 6) dvwaPageStartup( array( 'unauthenticated', 'phpids' ) );

At dvwa/includes/dvwaPage.inc.php (function dvwaPageStartup), comment out the first block:

//      if( in_array( 'authenticated', $pActions ) ) {
//              if( !dvwaIsLoggedIn()) {
//                      dvwaRedirect( DVWA_WEB_PAGE_TO_ROOT . 'login.php' );
//              }
//      }

Cheers

@digininja
Copy link
Owner

digininja commented Mar 16, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants