Friday, June 2, 2023

FOOTPRITING AND INFORMATION GATHERING USED IN HACKING

WHAT IS FOOTPRITING AND INFORMATION GATHERING IN HACKING?

Footpriting is the technique used for gathering information about computer systems and the entities they belongs too. 
To get this information, a hacker might use various tools and technologies.

Basically it is the first step where hacker gather as much information as possible to find the way for cracking the whole system or target or atleast decide what types of attacks will be more suitable for the target.

Footpriting can be both passive and active.

Reviewing a company's website is an example of passive footprinting, 
whereas attempting to gain access to sensititve information through social engineering is an example of active information gathering.

During this phase hacking, a hacker can collect the following information>- Domain name
-IP Addresses
-Namespaces
-Employee information 
-Phone numbers
-E-mails 
Job information

Tip-You can use http://www.whois.com/ website to get detailed information about a domain name information including its owner,its registrar, date of registration, expiry, name servers owner's contact information etc.

Use of  Footprinting & Information Gathering in People Searching-
Now a days its very easy to find anyone with his/her full name in social media sites like Facebook, Instragram,Twitter,Linkdedin to gather information about date of birth,birthplace, real photos, education detail, hobbies, relationship status etc.

There are several sites like PIPL,PeekYou, Transport Sites such as mptransport,uptransport etc and Job placement Sites such as Shine.com,Naukari.com , Monster.com etc which are very useful for hacker to collect information about anyone.  
Hacker collect the information about you from your Resume which you uploaded on job placement site for seeking a job as well as  hacker collect the information from your vehicle number also from transport sites to know about the owner of vehicle, adderess etc then after they make plan how to attack on victim to earn money after know about him/her from collecting information.




INFORMATION GATHERING-It is the process of collecting the information from different places about any individual company,organization, server, ip address or person.
Most of the hacker spend his time in this process.

Information gathering plays a vital role for both investigating and attacking purposes.This is one of the best way to collect victim data and find the vulnerability and loopholes to get unauthorized modifications,deletion and unauthorized access.



More information


  1. Hacking Tools For Beginners
  2. Hack Tools For Ubuntu
  3. Best Hacking Tools 2019
  4. Blackhat Hacker Tools
  5. What Is Hacking Tools
  6. Hacking Tools For Pc
  7. Pentest Tools Review
  8. Hacker Techniques Tools And Incident Handling
  9. Hacking Tools Online
  10. Pentest Tools Review
  11. What Are Hacking Tools
  12. Underground Hacker Sites
  13. Hackers Toolbox
  14. Pentest Tools Download
  15. Pentest Tools Linux
  16. Hacking Tools And Software
  17. Computer Hacker
  18. Pentest Tools Tcp Port Scanner
  19. Pentest Tools Website Vulnerability
  20. Hacker Tools Apk Download
  21. Hacks And Tools
  22. Hacker Tools
  23. Pentest Tools Open Source
  24. Hack Website Online Tool
  25. Hackrf Tools
  26. Pentest Tools
  27. Hacker Tools
  28. Hacker Tools For Pc
  29. Hacker Tools Github
  30. Bluetooth Hacking Tools Kali
  31. Hacker Tools
  32. Pentest Tools Open Source
  33. Hacking Tools For Windows 7
  34. Hacker Tools Software
  35. Hack Apps
  36. Hack Tools
  37. Hacker Tools For Mac
  38. Hacker Tools
  39. New Hacker Tools
  40. Pentest Tools For Ubuntu
  41. Hacker Tools List
  42. Hacker Security Tools
  43. Hack App
  44. Hack Tools Github
  45. Hack Tools Github
  46. Game Hacking
  47. Hacking Tools Software
  48. Github Hacking Tools
  49. Hacker Tools Linux
  50. Hack Tools 2019
  51. Hacker Tools For Pc
  52. Hacker Tools For Mac
  53. Hacking Tools
  54. Hacker Tools Apk Download
  55. Growth Hacker Tools
  56. World No 1 Hacker Software
  57. Hacking Tools Online
  58. Hack Tools Mac
  59. Tools For Hacker
  60. Pentest Tools Kali Linux
  61. Pentest Tools Kali Linux
  62. Hack Tools Online
  63. Free Pentest Tools For Windows
  64. Hackers Toolbox
  65. Hacker Tools List
  66. Hacking Tools Software
  67. Pentest Tools For Ubuntu
  68. Hack Tools For Pc
  69. Hacker Tools For Mac
  70. Hacking Tools 2019
  71. Hacker Tools Apk
  72. Top Pentest Tools
  73. Hacking Tools Software
  74. New Hack Tools
  75. Hacking Apps
  76. Hacking Tools Download
  77. Hacking Tools For Beginners
  78. Hacking Tools And Software
  79. What Are Hacking Tools
  80. Hacker Hardware Tools
  81. How To Make Hacking Tools
  82. How To Hack
  83. Pentest Automation Tools
  84. Pentest Recon Tools
  85. Pentest Tools Download
  86. Hacking Tools Name
  87. Pentest Tools Review

Thursday, June 1, 2023

NcN 2015 CTF - theAnswer Writeup


1. Overview

Is an elf32 static and stripped binary, but the good news is that it was compiled with gcc and it will not have shitty runtimes and libs to fingerprint, just the libc ... and libprhrhead
This binary is writed by Ricardo J Rodrigez

When it's executed, it seems that is computing the flag:


But this process never ends .... let's see what strace say:


There is a thread deadlock, maybe the start point can be looking in IDA the xrefs of 0x403a85
Maybe we can think about an encrypted flag that is not decrypting because of the lock.

This can be solved in two ways:

  • static: understanding the cryptosystem and programming our own decryptor
  • dynamic: fixing the the binary and running it (hard: antidebug, futex, rands ...)


At first sight I thought that dynamic approach were quicker, but it turned more complex than the static approach.


2. Static approach

Crawling the xrefs to the futex, it is possible to locate the main:



With libc/libpthread function fingerprinting or a bit of manual work, we have the symbols, here is the main, where 255 threads are created and joined, when the threads end, the xor key is calculated and it calls the print_flag:



The code of the thread is passed to the libc_pthread_create, IDA recognize this area as data but can be selected as code and function.

This is the thread code decompiled, where we can observe two infinite loops for ptrace detection and preload (although is static) this antidebug/antihook are easy to detect at this point.


we have to observe the important thing, is the key random?? well, with the same seed the random sequence will be the same, then the key is "hidden" in the predictability of the random.

If the threads are not executed on the creation order, the key will be wrong because is xored with the th_id which is the identify of current thread.

The print_key function, do the xor between the key and the flag_cyphertext byte by byte.


And here we have the seed and the first bytes of the cypher-text:



With radare we can convert this to a c variable quickly:


And here is the flag cyphertext:


And with some radare magics, we have the c initialized array:


radare, is full featured :)

With a bit of rand() calibration here is the solution ...



The code:
https://github.com/NocONName/CTF_NcN2k15/blob/master/theAnswer/solution.c





3. The Dynamic Approach

First we have to patch the anti-debugs, on beginning of the thread there is two evident anti-debugs (well anti preload hook and anti ptrace debugging) the infinite loop also makes the anti-debug more evident:



There are also a third anti-debug, a bit more silent, if detects a debugger trough the first available descriptor, and here comes the fucking part, don't crash the execution, the execution continues but the seed is modified a bit, then the decryption key will not be ok.





Ok, the seed is incremented by one, this could be a normal program feature, but this is only triggered if the fileno(open("/","r")) > 3 this is a well known anti-debug, that also can be seen from a traced execution.

Ok, just one byte patch,  seed+=1  to  seed+=0,   (add eax, 1   to add eax, 0)

before:


after:



To patch the two infinite loops, just nop the two bytes of each jmp $-0



Ok, but repairing this binary is harder than building a decryptor, we need to fix more things:

  •  The sleep(randInt(1,3)) of the beginning of the thread to execute the threads in the correct order
  •  Modify the pthread_cond_wait to avoid the futex()
  • We also need to calibrate de rand() to get the key (just patch the sleep and add other rand() before the pthread_create loop
Adding the extra rand() can be done with a patch because from gdb is not possible to make a call rand() in this binary.

With this modifications, the binary will print the key by itself. 

Related word


  1. Pentest Tools For Android
  2. Hack Tools For Ubuntu
  3. Hacking App
  4. Pentest Box Tools Download
  5. Hacker Search Tools
  6. Hacker Hardware Tools
  7. Github Hacking Tools
  8. Hacking Tools Download
  9. Github Hacking Tools
  10. Hack Tools Pc
  11. Hacker Tools Software
  12. Hacker Security Tools
  13. Blackhat Hacker Tools
  14. Hacker Security Tools
  15. Hackrf Tools
  16. Hacking Tools Download
  17. Hacking Tools Hardware
  18. Pentest Tools Website Vulnerability
  19. New Hack Tools
  20. Hacker Search Tools
  21. Pentest Tools Bluekeep
  22. New Hacker Tools
  23. Easy Hack Tools
  24. Hackers Toolbox
  25. Hacker Search Tools
  26. Pentest Tools Android
  27. Best Pentesting Tools 2018
  28. Github Hacking Tools
  29. Hacker Tools For Pc
  30. Hackrf Tools
  31. Hack Tools For Ubuntu
  32. Pentest Tools For Android
  33. Nsa Hack Tools
  34. World No 1 Hacker Software
  35. Hacking App
  36. Hacker
  37. Hacker Search Tools
  38. Hacking Tools Pc
  39. Pentest Box Tools Download
  40. Best Pentesting Tools 2018
  41. Hack App
  42. Hacking Tools Download
  43. Underground Hacker Sites
  44. Hacking Tools 2019
  45. Hack Tools Online
  46. Hacker Tools For Ios
  47. Hack Tools
  48. Pentest Tools For Mac
  49. Hacking Tools Usb
  50. Hacker Tools For Windows
  51. Pentest Recon Tools
  52. Hacker Tools For Pc
  53. Hack Tools Download
  54. Hack Website Online Tool
  55. Pentest Tools Framework
  56. Pentest Tools Nmap
  57. Hacking Tools And Software
  58. Pentest Tools For Ubuntu
  59. Hacking Tools 2019
  60. Hacking Tools Github
  61. Physical Pentest Tools
  62. Nsa Hack Tools
  63. Hacking Tools Hardware
  64. Nsa Hack Tools
  65. Pentest Tools For Mac
  66. New Hacker Tools
  67. Hacking Tools For Pc
  68. Hacker Tools For Mac
  69. Hackrf Tools
  70. Hacking Tools Mac
  71. Pentest Recon Tools
  72. Pentest Tools Alternative
  73. Hacking Apps
  74. Pentest Tools For Android
  75. Hackrf Tools
  76. Hacker Tools Online
  77. Tools For Hacker
  78. Hacker Tools Hardware
  79. Pentest Tools Alternative
  80. Nsa Hacker Tools
  81. Hacking Tools Github
  82. Hacker Tools For Ios
  83. Hacker Tools
  84. Hacker Tools Hardware
  85. Hacking Tools Download
  86. Hackrf Tools
  87. Hacking Tools Github
  88. Hacker Tools 2019
  89. Hacking Tools Usb
  90. Hack Tools For Mac
  91. Computer Hacker
  92. Hacker
  93. Hacker Tools Mac
  94. Pentest Tools Apk
  95. Pentest Tools Alternative
  96. Hacking Tools Pc
  97. Pentest Recon Tools
  98. Hacking Tools Windows
  99. Hacking Tools Hardware
  100. Pentest Tools For Windows
  101. Hacker Tools Linux
  102. Pentest Tools Alternative
  103. Blackhat Hacker Tools
  104. Pentest Tools For Android
  105. Hacker Tools Online
  106. Hacking Tools Windows
  107. Best Hacking Tools 2019
  108. Free Pentest Tools For Windows
  109. Hacking Tools 2020
  110. Hacking Tools Windows

Reversing Rust String And Str Datatypes

Lets build an app that uses several data-types in order to see how is stored from a low level perspective.

Rust string data-types

The two first main objects are "str" and String, lets check also the constructors.




Imports and functions

Even such a basic program links several libraries and occupy 2,568Kb,  it's really not using the imports and expots the runtime functions even the main. 


Even a simple string operation needs 544 functions on rust:


Main function

If you expected see a clear main function I regret to say that rust doesn't seem a real low-level language In spite of having a full control of the memory.


Ghidra turns crazy when tries to do the recursive parsing of the rust code, and finally we have the libc _start function, the endless loop after main is the way Ghidra decompiles the HLT instruction.


If we jump to main, we see a function call, the first parameter is rust_main as I named it below:



If we search "hello world" on the Defined Strings sections, matches at the end of a large string


After doing "clear code bytes" we can see the string and the reference:


We can see that the literal is stored in an non null terminated string, or most likely an array of bytes. we have a bunch of byte arrays and pointed from the code to the beginning.
Let's follow the ref.  [ctrl]+[shift]+[f] and we got the references that points to the rust main function.


After several naming thanks to the Ghidra comments that identify the rust runtime functions, the rust main looks more understandable.
See below the ref to "hello world" that is passed to the string allocated hard-coding the size, because is non-null terminated string and there is no way to size this, this also helps to the rust performance, and avoid the c/c++ problems when you forgot the write the null byte for example miscalculating the size on a memcpy.


Regarding the string object, the allocator internals will reveal the structure in static.
alloc_string function call a function that calls a function that calls a function and so on, so this is the stack (also on static using the Ghidra code comments)

1. _$LT$alloc..string..String$u20$as$u20$core..convert..From$LT$$RF$str$GT$$GT$::from::h752d6ce1f15e4125
2. alloc::str::_$LT$impl$u20$alloc..borrow..ToOwned$u20$for$u20$str$GT$::to_owned::h649c495e0f441934
3. alloc::slice::_$LT$impl$u20$alloc..borrow..ToOwned$u20$for$u20$$u5b$T$u5d$$GT$::to_owned::h1eac45d28
4. alloc::slice::_$LT$impl$u20$$u5b$T$u5d$$GT$::to_vec::h25257986b8057640
5. alloc::slice::hack::to_vec::h37a40daa915357ad
6. core::slice::_$LT$impl$u20$$u5b$T$u5d$$GT$::len::h2af5e6c76291f524
7. alloc::vec::Vec$LT$T$GT$::extend_from_slice::h190290413e8e57a2
8. _$LT$alloc..vec..Vec$LT$T$GT$$u20$as$u20$alloc..vec..SpecExtend$LT$$RF$T$C$core..slice..Iter$LT$T$GT$$GT$$GT$::spec_extend::h451c2f92a49f9caa
...


Well I'm not gonna talk about the performance impact on stack but really to program well reusing code grants the maintainability and its good, and I'm sure that the rust developed had measured that and don't compensate to hardcode directly every constructor.

At this point we have two options, check the rust source code, or try to figure out the string object in dynamic with gdb.

Source code

Let's explain this group of substructures having rust source code in the hand.
The string object is defined at string.rs and it's simply an u8 type vector.



And the definition of vector can be found at vec.rs  and is composed by a raw vector an the len which is the usize datatype.



The RawVector is a struct that helds the pointer to the null terminated string stored on an Unique object, and also contains the allocation pointer, here raw_vec.rs definition.



The cap field is the capacity of the allocation and a is the allocator:



Finally the Unique object structure contains a pointer to the null terminated string, and also a one byte marker core::marker::PhantomData



Dynamic analysis

The first parameter of the constructor is the interesting one, and in x64 arch is on RDI register, the extrange sequence RDI,RSI,RDX,RCX it sounds like ACDC with a bit of imagination (di-si-d-c)

So the RDI parámeter is the pointer to the string object:



So RDI contains the stack address pointer that points the the heap address 0x5578f030.
Remember to disable ASLR to correlate the addresses with Ghidra, there is also a plugin to do the synchronization.

Having symbols we can do:
p mystring

and we get the following structure:

String::String {
  vec: alloc::vec::Vec {
    buf: alloc::raw_vec::RawVec {
      ptr: core::ptr::unique::Unique {
        pointer: 0x555555790130 "hello world\000",
        _marker: core::marker::PhantomData
     },
     cap: 11,
     a: alloc::alloc::Global
   },
   len: 11
  }
}

If the binary was compiled with symbols we can walk the substructures in this way:

(gdb) p mystring.vec.buf.ptr
$6 = core::ptr::unique::Unique {pointer: 0x555555790130 "hello world\000", _marker: core::marker::PhantomData}

(gdb) p mystring.vec.len

$8 = 11

If we try to get the pointer of each substructure we would find out that the the pointer is the same:


If we look at this pointer, we have two dwords that are the pointer to the null terminated string, and also 0xb which is the size, this structure is a vector.


The pionter to the c string is 0x555555790130




This seems the c++ string but, let's look a bit deeper:

RawVector
  Vector:
  (gdb) x/wx 0x7fffffffdf50
  0x7fffffffdf50: 0x55790130  -> low dword c string pointer
  0x7fffffffdf54: 0x00005555  -> hight dword c string pointer
  0x7fffffffdf58: 0x0000000b  -> len

0x7fffffffdf5c: 0x00000000
0x7fffffffdf60: 0x0000000b  -> low cap (capacity)
0x7fffffffdf64: 0x00000000  -> hight cap
0x7fffffffdf68: 0xf722fe27  -> low a  (allocator)
0x7fffffffdf6c: 0x00007fff  -> hight a
0x7fffffffdf70: 0x00000005 

So in this case the whole object is in stack except the null-terminated string.




More info