1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501
|
Welcome to the documentation of the ELZA scripting language.
====================================================================
----- } INTRODUCTION
====================================================================
The ELZA is a scripting language aimed at automating requests on web
pages.
Scripts written in ELZA are capable of mimicring browser behavoir almost
perfectly, making it extremely difficult for remote servers to distinguish
their activity from the activity generated by ordinary users and browsers.
This gives those scripts the opportunity to act upon servers that will not
respond to requests generated using netcat, gammaprog, rebol, or similar
tool.
Core features:
- Extraction of _dynamic_ URLs from links, frames, layers, image maps,
applet parameters and other HTML elements, based on _static_ attributes
of those elements, such as name, sequence number or the text visible to
the user.
- Handling of forms, passing custom form fields and field values,
collecting hidden form fields;
- Following redirects and refreshes;
- Proper handling of cookies, honoring their Path and Domain attributes;
- HTTP Referer, User-Agent, and other HTTP headers for perfect mimciry;
- Handling HTTP Basic and Digest authentication
including dictionary attacks;
- Support for Keep-Alive connections.
- Quite sofisticated looping for repeated requesting or dictionary attacks;
- Conditional execution;
- HTTPS communication via a SSL tunnel;
- Arbitary changing of request destination;
- HTTP and SOCKS Proxy server support (including rotation);
- Pausing and resuming.
Scripts written in ELZA can be executed remotely via POST or forked.
Please read the sections below for more information.
---------- } WHAT ELZA IS NOT
Elza is NOT a fancy Win32 application written in MFC 2000, featuring:
- Cool menu animations;
- Cooler background textures;
- Even cooler dialog boxes with irregular geometry.
- Multithreading able to bring down Windows 95 kernel.
Elza is NOT a tool that will get you into an HTTP server through the front
door. If you want to attack somebody, you have to construct an attack first.
If you want to do dictionary attacks, you have to find a dictionary as well.
However, once you construct an attack, the ELZA is probably the tool that
will be able to carry it out.
---------- } BLACK HATS
--------------- } MAKE SERVERS TRUST YOU
I am positive that using "nc www.some-server.com 80" can go a long way,
if you want to talk to a web server, but I am also positive that nc does
not have cookie-handling capabilities.
The ELZA will try to make the HTTP daemon and its scripts trust you (as
much as they would trust any user browsing). To them will appear as a
valid person browsing around. The ELZA will:
1. Follow a completely legitimate path through the server, instead
of hammering directly at some URL deeply inside.
2. Send valid REFERER and USER-AGENT request fields, along with some
other for greater mimicry.
3. Accept cookies and send them back, honoring 'path' and
'domain' attributes of the cookie.
4. Collect all HIDDEN fields from a page to send them with
the next request.
5. Determine valid URLs for objects, following dynamic links,
redirects, refreshes, frames, layers, etc.
6. Authenticate using forms or HTTP basic and Digest authentication.
To summarize, the ELZA places you in a position to make the requests you
want while being trusted by the server.
--------------- } DO WHATEVER YOU WANT
After you have established trust with the web server, you can do whatever
you want: automatically fill in heavily-protected forms (or make local
copies of those), do some buffer-overflowing or dictionary-attacks.
Want to create 1000 hotmail accounts? No problem, just execute hotadd.elz
and feed in a feed a list of usernames.
Want to hijack a heavily protected HTML form? Saving it locally will not
help - dynamic stuff (fields, cookies, URLs) is gone, and you now have an
ugly 'Referer: c:\hack\hackform.html'. Instead, script the steps needed to
get to the remote form and have HTMLELZA generate a local form that will
care about all those things.
--------------- } REMAIN UNNOTICED (until the end, probably)
0. Every effort has been made to make your requests completely
legitimate, thereby causing no suspicion to the remote web server
and its CGI scripts. For example, no alarms will go off because
you have made a request without a valid User-Agent, or because
you are lacking a cookie site's logic requires you to have.
1. Requests to the web server may not be issued quickly one after
another, so that they do not appear as a bunch of consequtive
lines in the log file, making them easier to spot.
2. Requests can be rotated through different proxy servers.
3. You are allowed to change your IP address between requests
(dialdown/dialup/DHCP renew).
--------------- } OVERFLOWING CAPABILITIES
It is certainly possible to cause a buffer overflow in a badly written
script, such as one that stores a field value in a 10-byte
long string variable, expecting the JavaScript check on the form that
posts to it to prevent the input of more than 8 bytes.
However, you will not be able to overflow this buffer, if there are
numerous cookie checks in the CGI script before the code that overflows.
If you hammer directly at such script, you will never get to the
overflowing part.
Here, the ELZA comes handy. It will make nice requests to the remote
web server, requests that have all the things they should have, except
for the element(s) you want to overflow.
--------------- } PASSWORD BRUTE-FORCING AND BLIND REQUESTING
The ELZA can take data from an external file and feed it to remote
servers in various ways.
For example, you can feed in a dictionary file and perform a dictionary
attack against web pages requiring authenticaton via HTTP or via a logon
CGI script. The ELZA supports MD5 Digest authentication.
Or, you can feed in a list of URLS and have the ELZA request them and see
if they exist.
You can do all this multitreaded in Keep-Alive using HEAD.
Feel the difference.
---------- } WHITE HATS
--------------- } SIMIULATIONS AND LOAD GENERATION
I am by no means a clustered web servers expert, but I do not think
that you can evaluate the performance of your server by sending in
a bunch of "GET /index.html HTTP/1.0\n\n" requests, if, for example,
your hyper-secure authentication scripts make 1000 SQL requests for
a single user and your hyper-cryptographically-robust cookie-generation
algorithm takes 10 minutes to complete. Using this script, you can both
force the hyper-secure authentication scripts to make the 1000 database
requests and the hyper-cryptographically-robust cookie-generator-validators
to generate and validate the 10-minute cookies.
The ELZA can help you answer the following basic questions:
1. How does your server react on dictionary attacks against your
authentication mechanisms. You see the log grow, and then what?
2. How does your server react on repeated requests for nonexisting URLs?
Do you consider this as somebody hammering on his keyboard and
pressing the ENTER key in Internet Explorer?
3. How long does it take for you to service 1000 legitimately filled
add-new-user registration forms?
--------------- } IMPROVING INTRUSION DETECTION AND
AVOIDING RESPONDING TO MALICIOUS REQUESTS
If you currenty think that a valid REFERER and USER-AGENT in the
request guarantee that the request comes from some good guy with
a typical browser, I hope you will no more.
Recently, there was a post to BugTraq stating that one can fool
IE5 to send an arbitary REFERER header. Well, it is self-evident
no IE5 is needed. This script gives people enough of the
functionality of IE, plus a lot more.
---------- } REMOTE EXECUTION
The ELZA interpreter can be run as a CGI script, taking variables from
an HTML form and using those when performing it work.
For example, you can post a form on your site that creates valid hotmail
accounts, or does SMS messaging, or, whatever ... sky is the limit.
====================================================================
----- } INSTALLATION
====================================================================
---------- } REQUIREMENTS
0. An operating system of some sort.
1. Perl
Win32 - look at www.activestate.com
Other - see your favorite distribution site.
2. The MIME:base64.pm perl module for password encoding
http://amaunet.informatik.uni-dortmund.de/cgi-bin
/CPAN/authors/id/GAAS/MIME-Base64-2.11.tar.gz
3. SSL tunnel for making HTTPS requests.
Win32 - http://mike.daewoo.com.pl/computer/stunnel/
Other - see your favorite distribution site
4. NET:SOCKS Perl module for SOCKS proxy support
Get one from your local CPAN mirror.
4. Digest:MD5 module for MD5 Digest authentication.
---------- } INSTALLATION
1. Unzip the archive into a single directory. If you want to run ELZA
scripts remotely, place a copy in your favorite cgi-bin directory.
2. Edit elza.def and configure it for your operating system and
SSL tunnel.
3. Edit the first line elza.pl to point to the location of your Perl.
---------- } COMPATIBILITY
This script has been tested on the following platforms:
1. Windows 95 B and C
+ perl 5.003_07 Build 316
+ apache 1.3.9 + stunnel i586-pc-mingw32-gnu WIN32
2. DosLinux (Debian-derivative)
+ perl + apache 1.3.3 + stunnel
(all coming from the respective debian packages)
(both fitting on a single 200Mb hard drive)
==========================================================================
----- } COMMAND LINE INTERFACE
==========================================================================
The interpereter (elza.pl) has a relatively simple interface:
perl elza.pl SCRIPT.elz
or
./elza.pl SCRIPT.elz
(if you have configured the first line of elza.pl)
or
perl elza.pl
(and then specify script file when prompted.
Variables are specified either in the .elz script, or in elza.def
If you want to run the ELZA as a CGI script, please read the corresponding
section below.
If you want to run multiple instances of ELZA, also see below.
==========================================================================
----- } SUBSTS AND VARIABLES
==========================================================================
---------- } GENERAL CONSIDERATIONS
The ELZA distinguishes between 'substs' and 'variables'.
Substs are things you set with the sole intent that when they are
encountered, they will be replaced with the content you specify. Until
statements act upon substs. So, if you have:
subst foo = bar.html
get url http://localhost/foo
you will perform a GET on bar.html, because the subst foo was
replaced with value bar.html
The %VARIABLE% subst contains the current value of the variable VARIABLE.
For example:
print %body%
will print the value of the variable 'body' for you.
Variables hold values set up by user, as well as things the ELZA set up,
such as the current host or port, the last HTML body returned, etc.
---------- } SETTING SUBSTS
Any occurences of a subst in the command file from now on will be replaced
with VALUE, no metter where they are (except if on other subst lines).
subst SUBST = VALUE
Sets SUBST to VALUE.
subst SUBST c= COOKIE
Sets SUBST to the current value of COOKIE.
subst SUBST f= FIELD
Sets SUBST to the current value of the FIELD form field.
subst SUBST ? DEFAULT VALUE
This will prompt the user to enter value for SUBST.
DEFAULT VALUE is used if the user does not enter anything (i.e.
just hits enter.
NOTE: If no VALUE or DEFAULT VALUE is provided, the subst is set
to an empty string, that is, any future occurences _are_ replaced
with an empty string.
subst SUBST -
Deletes SUBST and it is not substituted any more. If you want
to set a subst to an empty string, do the following:
subst SUBST =
subst SUBST random BEGIN END
Will set SUBST to a random value somewhere in the range from BEGIN
to END.
subst SUBST between BEGINHTML ENDHTML
Will scan the last response received (or the current container) and
will set SUBST to the first text that happens to be between BEGINHTML
and ENDHTML. Case insensitive. For example:
subst APACHE_ADDRESS betweeen <address> </address>
will set APACHE_ADDRESS to whatever is between those tags, and this
is the signature of the Apache server that has generated the HTML
we are examining.
subst SUBST @ VALUE1 VALUE2 VALIE3
Pushes all VALUEs in an array so that the first is substituted the
first time the SUBST is encountered, the second - the second time
and so on. After all VALUEs have been cycled, we start again from
the first value. For example:
subst BOZO @ one.html two.html three.html
get url /BOZO
get url /BOZO
get url /BOZO
get url /BOZO
will make the following requests:
GET /one.html
GET /two.html
GET /three.html
GET /one.html
NOTE: Using substs of this type in 'print' statements does not
alter the counters, so you can print the current value of a
subst, without fearing that you will print the next value in fact.
For example, this is safe to do:
subst BOZO @ one.html two.html three.html
get url /BOZO
print We just requested BOZO
If you want to use the same value of a dynamic SUBST more than once,
you either need to use a 'call PROCNAME SUBST ' construction, or
assign the current value of the dynamic SUBST to a static one.
For example:
subst BOZO @ one two three
# Those two requests will go to the 'one' directory
subst DIRECTORY = BOZO
get url /DIRECTORY/one.html
get url /DIRECTORY/two.html
# The next two requests will go to the 'two' directory
subst DIRECTORY = BOZO
get url /DIRECTORY/one.html
get url /DIRECTORY/two.html
subst SUBST raw FILENAME
Will take the first 100000 or less characters from FILENAME and
will feed them into SUBST. You can possibly deliver payloads
this way.
NOTEZ:
A SUBST will not be substituted on lines beginning with
'subst SUBST' (i.e. lines, pertaining to the same SUBST).
That is, you can NOT (currently) do the following:
subst foo = bar
subst foo = bozo
and get subst bar = bozo
---------- } SETTING VARIABLES
var VARIABLE = VALUE
This will set the VARIABLE variable to VALUE. For example, to
turn on dumping, you will do the following:
var rawfile = dump.raw
var VARIABLE from ATTRIBUTE @ TAGTYPE TAGMATCHATTRIB TAGMATCHVALUE
This will set VARIABLE to ATTRIBUTE of the first tag of type
TAGTYPE has TAGMATCHATTRIB equal to TAGMATCHVALUE.
For example,
var THELINK from text @ link number on
will set THELINK to the visible text of the first link of the
current html page.
var ALTTEXT from alt @ img src foo.jpeg
will set ALTTEXT to the alt attribute of the <IMG> tag that points
to foo.jpeg.
var VARIABLE =
Sets VARIABLE to an empty string.
var VARIABLE -
Deletes VARIABLE.
var VARIABLE ? DEFAULT VALUE
Prompts for value for VARIABLE.
var VARIABLE c= COOKIE
Sets VARIABLE to the value of COOKIE.
Please note that setting an VARIABLE to an empty string is different from
deleting it entirely.
==========================================================================
----- } MAKING REQUESTS
==========================================================================
This is what the ELZA is all about - making requests.
(get|post|head) url URL
Will perform a request directly on the URL. Use if you
want to perform some action on a object that has fixed
URL. Examples:
get url http://www.some-server.com
post url http://www.some-server.com/cgi-bin/phf
(get|post|head) TAG TAGATTRIBUTE ATTRIBUTEVALUE
Will scan the last response received (or the container, see below)
for a TAG with TAGATTRIBUTE equal to ATTRIBUTEVALUE will perform
the request to the URL contained within the tag. Case sensitive.
Examples:
get link text Compose
will scan for an <A> tag that has "Compose" as the tag-stripped
text between <A> and </A> and will follow the URL specified in
the HREF tag attribute.
get link raw <B>Compose<B>
Will do the same, but will do a match on the raw HTML between
<A> and </A> as it is.
Use those if you want to go to a URL that changes with each
session, such as the URL of the "Compose Message" page in
Hotmail. The "Compose" text, however, is constant, and leads
us to the HREF.
post form name passwordform
will scan for a <FORM> tag named "passwordform" and will do a
POST against the URL in the ACTION atribute of the tag.
get frame number 1
will scan for the first <FRAME tag and GET the url from the SRC
attribute of the tag.
(get|post|head) area coords COORDINATES
(get|post|head) area name AREANAME
Will simulate a user clicking on the area of a client-side
imagemap having this coordinates or name
For example: get area coords 0,19,68,50
(get|post|head) refresh
Will scan for the first <META HTTP-EQUIV="Refresh"> tag and will
follow the URL referenced in the CONTENT portion of the tag.
(get|post|head) %Location%
Will follow a 30* Moved server response, if the autoredir variable
is not set to 'on'. If it is set to 'on', such responses are
processed automatically.
hostmap FROMHOST FROMPORT TOHOST TOPORT
Creates a mapping so that every subsequent request destined to
FROMHOST on FROMPORT will be sent to TOHOST on TOPORT. The request
is preserved as it is and the 'host' and 'port' system variables
do not change.
If a proxy server is defined, the request will be piped through it
unmodified, i.e. it will go to FROMHOST on FROMPORT. To avoid this,
declare that FROMHOST on FROMPORT should not be accessed through
a proxy:
noproxy FROMHOST FROMPORT
hostmap FROMHOST FROMPORT TOHOST TOPORT
hostmap FROMHOST FROMPORT -
Deletes a previously created hostmap.
noproxy HOST PORT
Specifies that from now on requests to HOST on PORT will not be
piped through a proxy server, if one is defined, but will rather
be requested directly.
noproxy HOST PORT -
Removes the effect of a previously established 'noproxy' directive.
==========================================================================
----- } HANDLING FIELDS
==========================================================================
All fields set within the script will be transmitted ONLY with the next
request performed.
field NAME = VALUE
Sets field with name NAME to value.
field NAME ? DEFAULT VALUE
Prompts the user to enter a value
field NAME $
Scans the HTML for a HIDDEN field with name NAME and collects the
value to send it with the next request.
field %ALL% $
Collects all HIDDEN fields in the manner explained above.
field NAME > LENGTH
Sets the NAME form field to a bogus value with a length of
LENGTH. Usefull if you try to overflow something.
field %BOGUS% NAMELENGTH VALUELENGTH
Sets a bogus field with a name of NAMELENGTH characters
long to a value VALUELENGTH characters long.
field NAME -
Deletes field with name NAME from the list and it will not be
sent with the next request. This is useful if you first collect
all hidden fields, and then remove those you don't like.
field %ALL% $
field unwanted-field -
NOTEZ:
If you want to recycle field values, please set them as substs beforehand:
subst SEARCHSTRING = foo bar
field p = SEARCHSTRING
get url http://search.yahoo.com/bin/search
field q = SEARCHSTRING
get url http://www.altavista.com/cgi-bin/query
==========================================================================
----- } MANIPULATING COOKIES
==========================================================================
By default, the script will accumulate all cookies received and will
pass them with the next requests, honoring 'domain' and 'path' attributes.
If new value or attributes for existing cookie are received, they will
prevail over the old ones.
cookie COOKIENAME = COOKIEVALUE
Adds a cookie named COOKIENAME with a value of COOKIEVALUE to the
cookie list and transmits COOKIE as is with a Cookie: field in
every request from now on.
If you want to stop sending a cookie, delete it using - syntax.
cookie COOKIENAME path VALUE
cookie COOKIENAME domain VALUE
Will set the 'path' or 'domain' attribute of COOKINAME to PATH. It
will be much better if you do a 'cookie COOKIENAME = COOKIEVALUE'
to add the cookie before specifying path or domain
cookie COOKIENAME > LENGTH
cookie COOKIENAME ? DEFAULT VALUE
cookie COOKIENAME -
Those act in the manner described above (overflow,ask,delete)
cookie %ALL% -
Deletes all cookies _currently_ available. Future accumulation of
cookies will go as usual.
==========================================================================
----- } HTTP AUTHENTICATION
==========================================================================
When the ELZA runs into an URL that requires authenticaton,
it will start trying a single password, or all passwords from the
dictionary file, if you have supplied one.
Once a valid pair is found, the ELZA will continue down
the script. If no pair from the database is accepted by the
remote server, the ELZA will give up the request.
Currently, only one user and realm are supported at a time.
NOTE: If you are trying to dictionary-attack a form with a username and
password text boxes, this is not "HTTP authentication".
var user = USERNAME
Defines the USERNAME to be sent with passwords when authenticating.
var realm = REALM
Defines the REALM the username and the passwords belong to. If
authentication for a different realm is required, the ELZA will
generate an error condition.
var password = PASSWORD
Supplies a single password to be used when authenticating.
If it does not work, the elza will give up the request.
var dictionary = FILE
Uses FILE as a dictionary. Passwords are tried one after another
with no need of looping.
==========================================================================
----- } PROCEDURES
==========================================================================
proc PROCNAME
...
endproc PROCNAME
Statements appearing within a proc are executed only if called
with a 'call' statement.
If you name your proc BEFOREREQUEST, it will be executed before
each request. This is useful if you want to rotate each request
through different proxy server:
var proxyport = 8080
subst PROXY @ proxy1 proxy2 proxy3
proc BEFOREREQUEST
var proxyhost = PROXY
endproc BEFOREREQUEST
get url url1
get url url2
get url url3
... ...
get url url9999
==========================================================================
----- } CONDITIONAL EXECUTION AND OTHER OPTIONS
==========================================================================
if SOMETHING == VALUE COMMAND
if SOMETHING != VALUE COMMAND
PROCNAME if SOMETHING > VALUE COMMAND
if SOMETHING < VALUE COMMAND
Will make the ELZA execute COMMAND if the condition is met.
call PROCNAME
Will make the ELZA interperter execute the PROCNAME procedure.
call PROCNAME if SOMETHING == VALUE
call PROCNAME if SOMETHING != VALUE
call PROCNAME if SOMETHING > VALUE
call PROCNAME if SOMETHING < VALUE
Makes the ELZA execute PROCNAME if a condition is true.
NOTE: Case-sensitive regexp is applied for '=='.
Example:
proc NOINDEX
print This is not a directory index
exit
endproc NOINDEX
get url http://localhost/
call NOINDEX if %body% != index of
print This is a directory index
label LABELNAME
Defines a label to be used by the 'goto' directive.
goto LABEL
goto LABEL if SOMETHING (==|!=|>|<) VALUE
Those act the way 'call' does, but instead of evoking a procedure,
it jumps to the specified LABEL.
pause
Will make the ELZA pause and wait for the ENTER key.
This is useful if you want to enforce a dialup/dialdown or
a DHCP release/renew to obtain a different IP address or
use a different gateway.
sleep SECONDS
Will make the script sleep for SECONDS seconds and then
continue executing. This is useful if you do not want all
your requests to appear on consequtive lines in the
httpd or proxy files.
print TEXT
Will print out "--- TEXT" plus a newline character.
printraw TEXT
Will print out TEXT as it is. You can use \n and \t .
exec EXPRESSION
Will execute EXPRESSION as Perl code.
For example:
exec print "OUTPUT"
is equvalent to
print OUTPUT
exit
Will end the script immediately.
continue
Will do nothing. Used in 'var onerror = continue' statements.
stats
Will print out the contents of the counters so far, without
zeroing them. Please note that I do not know how to measure small
intervals under Unix, so on such platforms, the times and the
other calculations will not be very precise.
==========================================================================
----- } INPUTTING DATA FROM A FILE OR ARRAY
==========================================================================
The ELZA can read data from external file and use it when making requests.
This is useful for brute-forcing passwords and CGI scanning.
call PROCNAME SUBST @ VALUE1 VALUE2 VALUE3 VALUE4 ...
The ELZA will execute PROCNAME for every VALUE specified,
each time setting SUBST to the respective VALUE from the array.
call PROCNAME SUBST % FILE
The ELZA will open FILE and will perform PROCNAME for every line of
FILE each time setting SUBST to the respective line from FILE.
call PROCNAME SUBST forked FILE
This works exactly like the previous syntax. However, in forked
environments (see below), this syntax will ensure that the children
can successfully share a single FILE. That is, in a case of two
children, the first child will take the first line of the FILE,
the second - the second. The third line will be consumed by the
first child and so on. Thus, you can fork a dictionary attack using
a single dictionary and no word from the dictionary will be used
more than once or not used at all.
call PROCNAME SUBST ?
The elza will take accumulate values for SUBST from STDIN, until an
empty line is received.
NOTE:
Unlike the dynamic SUBSTs defined using 'subst SUBST @ ARRAY',
the 'call' statement sets a value for SUBST just before executing
the PROCNAME, and this value is _constant_ until the end of this
PROCNAME and therefore can be used many times within the PROCNAME
without fear.
---------- } EXAMPLES
Example #1 (Dictionary attack)
proc TRYONE
field user = philip
field passwd = PASSWORD
get url http://127.0.0.1/cgi-bin/loginform.pl
endproc TRYONE
call TRYONE PASSWORD % passwd.txt
Remember that fields are cleared after each HTTP request, so set
all of them within the procedure.
Example #2 (CGI Scanner)
proc TRYONE
get url http://127.0.0.1/cgi-bin/CGISCRIPTS
endproc TRYONE
call TRYONE CGISCRIPT % cgi-scripts.txt
This will make the ELZA read cgi.txt and make one request against
the cgi-bin directory for each script specified in cgi-scripts.txt
Example #3 (Nesting)
var onerror = continue
proc TRYSCRIPT
get url http//127.0.0.1/CGIDIR/CGISCRIPT
endproc TRYSCRIPT
proc TRYDIR
call TRYSCRIPT CGISCRIPT % cgi-dirs.txt
endproc TRYDIR
call TRYDIR CGISCRIPT @ cgi-bin cgi-local win-cgi
Here we make a request for every script for every directory.
==========================================================================
----- } HTML TAG ATTRIBUTES
==========================================================================
---------- } ATTRIBUTE REFERENCE
All tags have the attributes one can expect them to have (such as href,
src, name, etc.) plus some others:
text
This attribute is the tag-stripped text between the tag and the
respective close tag (only if a closing tag exists.
For example, for the following HTML:
<A name="foo" href="bar"> This is<B> the </B>text </A>
<A name="foo2" href="bar2"> This is<B> another </B>text </A>
the text attribute of the first <A> tag is 'This is the text'
raw
This is the no-tag-stripped HTML between the open and the close tag.
Therfore, for the above example, the raw attibute will be
' This is<B> the </B>text '.
body
This is the body of the tag from < to >. For the example, body will
be '<A name="foo" href="bar">';
number
This is the sequence number of the tag. For the example, number will
be '1', because this is the first <A> tag in the HTML.
---------- } USING TAG ATTRIBUTES
If you want to click on a link that says "Compose", you would use the
following:
get link text Compose
If you want to click on the 31-st link on a web page:
get link number 31
If you want to restrict subsequent parsing to the body of a single
<FORM> tag, you would do the following:
var container from raw @ form name theform
This will set your container (the HTML that is being parsed) to the
HTML between <FORM> and </FORM> of a form named 'theform'. Thus, you
will avoid parsing HIDDEN form fields located in other forms on the
same page.
==========================================================================
----- } ELZA BUILTIN VARIABLES
==========================================================================
Variables are set with 'var VARIABLE = VALUE'
keepalive = on
Will instruct ELZA to make Keep-Alive connections for much faster
HTTP access. I have noticed that Apache often does not honor
Keep-Alive if used with GET requests, because the length of the file
is not always known. However, if you use with HEAD, it will work just
fine, no matter what the server response is (200, 404, 401).
ses_rcv
ses_time
ses_speed
Those hold the stats from the last request. Please note that I do not know how to measure small
intervals under Unix, so on such platforms, the times and the
other calculations will not be very precise.
Speed is in bytes / sec. Time is in seconds.
container
If this variable is set, any subsequent statements (until the next
response from a server) will look for tags only within the contents
of container, rather than the entire HTML received from the last
response.
This enables you to restrict operations within a specific section
of the HTML, such as a <FORM>. For example:
var container from raw @ form name theform
will set the container to the HTML contained between <FORM> and
</FORM> tags of the form named 'theform'. So, this directive
field %ALL% $
will examine only the contents of this <FORM> for hidden tags,
and will not look into tags from other forms which may be present
in the initial HTML.
proxy = PROXYHOST PORT
From this line on, the script will pipe requests through
PROXYHOST proxy server on the PORT port. Equivalent to:
var proxyhost = PROXYHOST
var proxyport = PORT
NOTE:SSL requests are piped through the SSL tunnel, not
the proxy.
proxyhost = HOST
Sets the host part of a proxy definition to HOST
proxyport = PORT
Sets the port part of a proxy definition to PORT
sockshost = HOST
socksPORT = PORT
socksversion = VERSION
Set those three if you want to pipe requests through a SOCKS proxy.
NOTE: SOCKS support requres the NET::SOCKS module from CPAN and a
'$VAR{'sockssuport'} = 'on';' directive in elza.def
socksuser = USERNAME
sockspassword = PASSWORD
Set those if you want to authenticate to the SOCKS server.
sendagent = (on|off)
Enables or disables the sending of a User-Agent line in subsequent
HTTP requests. The default is 'on'.
agent = USERAGENT
Sets the current User-Agent to USERAGENT.
debug = on
Makes ELZA print an unacceptable amount of information about its guts.
silent = on
If set, the ELZA will output only the initial banner and
critical error messages. You have to produce the rest of the output
(if you need one) yourself using 'print' and 'printraw'.
If you want to suppress printing the banner, uncomment
$VAR{'silent'} = on
in the elza.def file.
If you are calling ELZA via POST, and you have
<INPUT TYPE="HIDDEN" NAME="silent" VALUE="on">
line in your form HTML, the ELZA will run completely silent
(no banner), which means that you have to construct a
Content-type: HTTP header at the top of your script:
printraw Content-type: text/plain\n\n
All the output is up to you. The ELZA is dumb.
rawfile = FILENAME
If set, the ELZA will dump to FILENAME communication with
remote servers in both directions.
tempfile = FILENAME
This is set in elza.def and controls the name of the temporary
files used to store the progress of a dictionary attack if one
is cancelled with Ctrl+C. If forking is used, the number of the
instance is appended to FILENAME so that each instance has its
own status file.
dumprequest = 1
Means that ELZA will dump the literal requests sent to servers.
dumprequest -
Means that ELZA will not dump the requests sent to the servers.
dumpheaders = 1
dumpheaders -
dumpbody = 1
dumpbody -
Those act in the manner described above, but on the header of
the response received and on the body of that response, respectively.
onerror = COMMAND
If an error condition occurs, the ELZA will perform COMMAND.
The default is "onerror = exit" to prevent further noise in the log
files of the remote server once you screw something up.
If you plan to brute-guess URLs, you need to use 'onerror = contunue'
otherwise the ELZA will give up after the first 404 Not Found error.
realm = REALM
Sets the realm to which authentication is to be performed with the
available passwords
user = USERNAME
Sets the USERNAME the available the passwords belong to.
Referer = URL
Sets the Referer to be sent with the next request (ONLY with the
next request). Please note the capital 'R'.
forcehead = on
Will make the ELZA interpreter close the HTTP connection after
receiving the header part. This is useful if you want to force
a HEAD like behavoir when the server does not allow HEAD requests.
This is useful if the server insists on sending very large
request bodies, such as a deliberately constructed huge
401 Authorization Required message to slow down dictionary attacks.
See also the 'maxlines' variable.
binary = on
Makes the ELZA treat the next server response as a binary file
(download) and will save it to the rawfile intact.
The dumpheaders, dumpbody, and dumprequest variables are not honored
in such case.
sendreferer = no
Instruct the ELZA not to send a Referer: with requests.
honorhttps = no
Tells ELZA not to treat https:// URLs as SSL requests. So, it will
not spawn an SSL tunnel but will rather request the URL as if it is
an http:// one.
autoresume = on
Will instruct the ELZA to keep track of the current position in a
dictionary file. Thus, if you stop a dictionary attack with Ctrl-C,
the next time you run the script, the attack will start from the
position it was stopped on. This feature will only work properly
if you use one and only one dictionary in your script file.
body
Contains the body of the last HTTP response received (i.e. the HTML)
url
Contains the complete URL of the last object requested.
base
Contains the base for relative URLs in last HTML, as specified by
the <BASE> tag. Used internally.
prefix
Contains the prefix of the last URL requested. Either 'http://' or
'https://'.
request
Contains the part after the domain for the last URL requested.
For 'url' = http://www.foo.com/bar/bozo, 'request' will be
'/bar/bozo'
protoversion
Contains the HTTP protocol version contained within the last response
received;
retcode
Contains the numerical return code of the last response received.
E.g. '200'.
rettext
Contains the textial return code of the last response received.
E.g. 'OK'.
All HTTP headers received in last response are also stored as variables.
If you use those, make sure you manually reset them before the request,
to make sure they are holding current info, and not data from previous
responses.
==========================================================================
----- } USING THE ELZA IN REMOTE MODE (CGI)
==========================================================================
You have a script (hotadd.elz) that will create an Hotmail
account for you and you want to execute this script eazily and remotely.
WARINIG: Adding a CGI script to your httpd path may become a security risk.
STEP 1. PREPARE HOTADD.ELZ FOR REMOTE EXECUTION
1. In hotadd.elz, define ACCOUNT and PASSWORD as substs:
subst ACCOUNT = defaultaccount
subst PASSWORD = defaultpassword
... and use them down the file to fill in the
registration form ...
field reglogin = ACCOUNT
field passwd = PASSWORD
field passwd1 = PASSWORD
2. In hotadd.elz, add the following line
elza-web-enabled
... which instructs the ELZA that it is safe to execute this
script when in CGI mode.
STEP 2. PREPARE THE ELZA FOR REMOTE EXECUTION
1. Place elza.pl in a cgi-bin directory of yours. Defining
access restrictions is always recommended.
2. Edit the following line in htmlelza.pl to point to its URL
$PathToElza = 'http://localhost/cgi-elza/elza.pl';
STEP 3. PREPARE AN HTML FORM FROM HOTADD.ELZ
c:\elza> perl htmlelza.pl c:\elza\hotadd.elz hotadd.html
... this will produce an HTML file with textboxes to enter values
for the abovementioned substs ACCOUNT and PASSWORD, and a button
to execute the hotadd.elz script.
Note that the absolute path to hotadd.elz is stored within the form.
See the HTML source to see how things are organised. Basically,
the 'elza-web-script' form field contains the script to
execute, while the other fields are treated as plain substs.
Upon clicking the button, the ELZA interperter will set the two
substs to the values entered in the form, and execute the script.
NOTES:
If you are calling ELZA via POST, and you have
<INPUT TYPE="HIDDEN" NAME="silent" VALUE="on">
line in your form HTML, the ELZA will run completely silent
(no banner), which means that you have to construct a
Content-type: HTTP header at the top of your script:
printraw Content-type: text/plain\n\n
The HTML line is inserted by HTMLELZA if you have
var silent = on
in your script.
==========================================================================
----- } ADDITIONAL NOTES
==========================================================================
Please see the file somecode.txt for more things one can play with.
---------- } FORKING
If you ever need to spawn several incarnations of ELZA scripts
simultaneously, use the following methods:
Under Win32, use elzafork.pl
perl elzafork.pl 5 hotadd.elz
Will spawn 5 incarnations of hotadd.elz for you. Remember to look at
elzafork.pl to adjust it to your configuration.
If you want all the instances to share a single dictionary file, use
the 'call PROC forked FILENAME' syntax described above. If you have
5 children, each children will take every 5th line from the dictionary
and use it as you see fit.
Under Unix, you can use unixfork.pl and get the same result as above.
Or, you can use use plain fork () in the first line of your script:
exec fork () ;
However, 'exec fork ()' does not care for proper handling of dictionary
files between child processes, so should only be used for simple load
generation.
Note that different incarnations of the ELZA interpreter share only
the console, and NOT cookies, fields, variables, or time counters.
Using the same local port for SSL may also be an issue, so either
randomize, or spawn the SSL tunnel beforehand.
---------- } PAUSING AND RESUMING DICTIONARY ATTACKS
Place the statement
var autoresume = on
in the beginning of your script file. Thus, if you have an
call PROC SUBST % FILENAME
construction, you can interrupt the iteration with Ctrl+C and
the next time the script is ran, it will start off from where it
left off.
ELZA accomplishes this by saving the current position in files,
specified by the tempfile variable (by default 'elza.tmp' + instance
number). If you have used ELZAFORK, when you resume, you must use the
same number of incarnations. Otherwise, some of your dictionary file
may never be processed.
Please note that this will work properly if you have only one
'call PROC SUBST % FILENAME' statement in your script. Since the
temporary files where the status is stored may be shared, you may
want to do something like
var tempfile = my-script-name.tmp
so that other scripts do not overwrite the temp files.
Please note that the pause/resume functionality does not work with
Authentication dictionaries defined with 'var dictionary'.
---------- } BACKGROUND EXECUTION UNDER WIN32
Under Win32, you can use the following trick to make the ELZA
interpreter run in background:
1. Adjust elzafork.pl to your configuration.
2. In elzafork.pl, uncomment this line:
$ElzaFlags = 'background';
3. Run
perl elzafork.pl 1 hotadd.elz
This will spawn one incarnation of the interperter running
hotadd.elz running in the background. To kill it, you need to use
Ctrl+Alt+Del , Ctrl+Esc, or some other process monitor.
---------- } SELECTIVE DUMPING
If you just need to log communication that took place for a specific
request(s) only, you can use the following syntax:
get url http://localhost/FOO
var rawfile = raw.out
get url http://localhost/BOZO
var rawfile -
get url http://localhost/BAR
Thus, only the /BOZO request will be dumped, not /FOO or /BAR.
If you want to log only the HTML, set things this way:
var rawfile = raw.out
var dumprequest -
var dumpheaders -
var dumpbody = 1
---------- } SECURITY CONSIDERATIONS
Please, please review your .elz script before making it available
for remote execution. Executing the ELZA interpreter via POST
enables specifying alternative values for all substs defined with
a 'subst' directive within the .elz script.
Some effors have been made to make ELZA safe to execute as a CGI
script. However, no guarantee is made that it does not contain
security holes. If you find some, please, PLEASE, report those.
---------- } ABOUT THE AUTHOR
This script was authored by Philip Stoev, who can be located
on the following coordinates:
web : phiphi.hypermart.net
email: philip_stoev@iname.com
icq : 23465869
phone: (359 2) 71 59 49
Feedback is always appreciated.
Being currently underemployed, I have some free time to spare.
Please feel free to request a part or all of it.
---------- } REQUESTING URLS ANONYMOUSLY
From the multitude of options you have, here is one: use the
Add-URL functionality in AltaVista or Lycos.
This should be self explanatory if you look at the dump files:
field q = http://www.yoursite.com/page.html
field ad = 1
get url http://add-url.altavista.com/cgi-bin/newurl
or
field query = URL
field email = youremail@yourdomain.com
get url http://www.lycos.com/cgi-bin/spider_now.pl
---------- } HTTP REFERER ISSUE
Undoubtedly, many sites will not let you get a page or execute
a script without a vaild Referer request field.
However, if you request a non-existing object on some sites,
www.cisco.com being one of them, and you have a Referer URL from
the same domain, the server will think that you have been referenced
by some page within the site that contains a broken link, and will
sound an alarm to the webmaster to go and fix the link.
This is may not be what you want.
---------- } CREDITS
Special thanks go to the actual human Elza.
Thanks go to the rain.forest.puppy (rfp@wiretrip.net) for the ideas
I adopted from his excellent CGI scanner named whisker. Get it from:
http://www.wiretrip.net/rfp
Credits and thanks go to the following people:
- The makers of the following PERL modules: win32, win32:proces,
HTML:Parser, MIME::Base64, NET:SOCKS; Digest:MD5.
- The Digest authentication code is based on a libwww post by
Doug MacEachern (dougm@osf.org) from 10 Mar 1996 15:39:22 (wow, old).
- The makers of stunnel, whoever they are.
---------- } DISCLAIMER AND COPYRIGHT
Since the GPL means practically nothing in Bulgaria (Microsoft's
EULA doesn't either), the ELZA interpreter is placed in the public
domain.
Yes, I do disclaim all responsibility for this script and any use
or misuse thereof, but it is really not necessary. Those words have
no value where I live.
=======================================================================END
|