Am I affected by the Intel AMT/ISM/SBT escalation of privilege vulnerability? I read about the security vulnerability that Intel explains here

On other sites I have read that Intel Core-i CPUs are affected too and that Intel AMT has to do with the vPro name.

Their guide on finding out if you are affected asks me to check for the vPro badge, so I started by checking if my systems support vPro.

I have a desktop Intel CPU (4790K) that according to Intel's Ark doesn't have the vPro feature, as well as the Z97 chipset. Can I now assume that I am not affected by the vulnerability on that machine?

On another system I have a Xeon E3-1220v5 CPU that does have the vPro feature according to Intel's Ark. However, the C232 chipset that I am using with it doesn't have the vPro feature. Can I also assume here that I am safe from the mentioned vulnerability?

Both system are running Linux and BSD.

Based on Matthew Garrett - Intel's remote AMT vulnerablity, which is among the most reasonable (in terms of amount of hyperbole) articles I've seen so far, you can only be affected if your system meets all four of the following criteria:

A CPU supporting Active Management Technology
A motherboard chipset supporting AMT
Supported network hardware
The Management Engine firmware contains the AMT firmware

There is no guarantee if your system meets all four criteria that it is affected, but if it does not meet all four, then it cannot be affected by the vulnerability as currently known.

Based on your statement that the chipsets in both your systems do not support vPro (of which AMT is one part), we can then conclude that neither meets all four criteria and thus neither system can be affected.

Specifically, in order to be affected, you need to have vPro, but having vPro-capable hardware alone is not sufficient to be affected; your system also needs to have the AMT nuts and bolts (e.g. its firmware) installed. That would under every normal circumstance be done by your system vendor.

Apparently, under Linux, you can check for AMT by looking at the lspci output; if lspci lists no communications controller with MEI in the description, then AMT is not running and you are safe.


How can I measure (and increase) entropy on Mac OS X? I'd like to generate a bunch of keys for long term storage on my MacBook.

What's a good way to:

measure the amount of entropy and ensure it is sufficient before each key is generated, and
increase the entropy if needed?

Something similar to Linux's /dev/urandom and /dev/random…

First, note that on OS X, /dev/random and /dev/urandom have the same behavior; /dev/urandom is provided as a compatibility measure with Linux. So, while you will see much advice online to use /dev/random because it will block if insufficient entropy is available, that is not the case under OS X.

/dev/random uses the Yarrow CSPRNG (developed by Schneier, Kelsey, and Ferguson). According to the random(4) manpage, the CSPRNG is regularly fed entropy by the 'SecurityServer' daemon. Unlike Linux, reading values from /dev/urandom does not exhaust an entropy "pool" and then fall back on a CSPRNG. Instead, Yarrow has a long-term state and is reseeded regularly from entropy collected in two different pools (a fast and slow pool), and reading from /dev/random pulls directly from the CSPRNG.

Still, the random(4) manpage notes:

  If the SecurityServer system daemon fails for any reason, output quality will suffer over time without any explicit indication from the random device itself.

which makes one feel very unsafe. Furthermore, it does not appear that OS X exposes a Linux-style /proc/sys/kernel/random/entropy_avail interface, so there is no way to measure how much entropy the SecurityServer daemon has fed Yarrow, nor does there appear to be a way to obtain the current size of the entropy pools.

That being said, if you are concerned about the amount of entropy currently available, you can write directly to /dev/random to feed the CSPRNG more data, e.g. echo 'hello' >/dev/random (of course, hopefully you would use actual good, random data here). Truth be told, though, the default behavior probably suffices; but if you're feeling paranoid, use a Linux live distro, maybe with a hardware RNG attached, and generate your keys from /dev/random.


How can I interpret openssl speed output? I ran openssl speed on my Ubuntu computer. Some results:

Doing md4 for 3s on 16 size blocks: 9063888 md4's in 3.00s
Doing md4 for 3s on 64 size blocks: 7105157 md4's in 3.00s
Doing md4 for 3s on 256 size blocks: 4507884 md4's in 3.00s
Doing md4 for 3s on 1024 size blocks: 1809773 md4's in 2.99s
Doing md4 for 3s on 8192 size blocks: 275679 md4's in 3.00s

What exactly those numbers mean?

what is 'Doing md4 for 3s' mean? does it mean do the whole test for 3 times/seconds?
what does '1809773 md4's in 2.99s' mean?
what does '8192 size blocks' mean?

It ran md4 as many times as it could for 3 seconds
This is how many times it managed to complete in 3 seconds
This is the size of blocks used. You can see how much longer a block of 8192 takes than a block of 16


Which areas of my computor are at risk if I set up MySQL on port 3306 unencrypted? Does this just put the MySQL data at risk or pose a risk to my whole computer as well?

I'm using my personal device and setting up MySQL as I seem to need it to use Wordpress on my device.

Opening a port means that other devices can communicate with your computer on that port, assuming there's a program listening on that port.  It's extremely likely MySQL will be the only thing that ever listens on port 3306 on your computer.

Generally speaking, you are correct that it will only allow an attacker to (potentially) access your MySQL data.  However, if the user they've gotten access to has sufficient permissions, they can directly run arbitrary shell commands on your computer.  Additionally, there are periodically vulnerabilities found in MySQL that could allow an attacker to run shell commands even without this permission.

However, backing up a bit, if you're running Wordpress and MySQL on the same computer, you don't need to open up the port at all.

In short:

Restrict access to the port to only the one computer running Wordpress.
Give your MySQL user accounts the minimum required permissions.
Keep MySQL up to date.


Server not requesting for certificate in SSL handshake I have one windows service and web service trying to make a web service call over TLS. I have setup the certificates in MMC and I am able to successfully connect using the web service.  However, when I try to make the same call using same certificate from Windows Service it is unable to establish the connection. Both web service and windows service are running under local system account. I tried using Microsoft Network Monitor and found that when using with Windows Service, server is not providing the certificate during SSL handshake. What could be the reason to this? Following are screenshots of the network monitor.

In your second screenshot you see that the server sends its ServerHello and no subsequent Certificate Request... but no Certificate either. The server immediately proceeds with a ChangeCipherSpec, as if all the asymmetric crypto had already been done; and that's exactly the case. This is an abbreviated handshake in which both client and server remember the session secrets from a previous connection, and agree to use them again. When a session is thus resumed, there is no certificate, neither from the client, nor from the server. The client sends in the ClientHello a copy of the session ID from the previous session, and the server elects to indeed resume that session.

Ideally this is fine; if the previous session used an authentication that the server is comfortable with (e.g. a client certificate was indeed shown), then reusing the session implies reusing that authentication state. If the server is not comfortable with it, it may reject the resumption attempt (i.e. ignore the session ID as sent by the client, and proceed with a full, normal handshake) or enforce a re-handshake within the first. In a practical, realistic World, things are not always ideal, so the server code may accept to reuse the session, then decide that it should not have done so, and hide its shame by abruptly closing the connection.

SSL session parameters are cached in RAM, so restarting the client and/or the server process should empty such caches and at least allow you to obtain a clearer picture of what happens. It might also fix the issue altogether (that's the lightweight version of "try a reboot", a well-known cure for many Windows-related ailments).


HSTS preventing MiTM cookie hijacking attacks I was watching the following presentation:

https://www.youtube.com/watch?v=jYcx7WtbB0A

It addressed the issue when trying to access a particular web site that is available over both HTTP and HTTS and that the initial request will be send via HTTP hence exposing cookies to eavesdropping /MiTM attacks and how HSTS can address this type of issues.

The ultimate solution would be to have ALL  content to be served via HTTPS so that no packet exchange is made via HTTP at all, or will it not block it?

But for HSTS to work in a mixed HTTP/HTTPS scenario each page that I’m requesting (the browser will default to HTTP) will have to be available via HTTPS as well, right ? If it’s not, HSTS will not allow to make an HTTP connection at all?

Also if you look at 8:22 in the movie there’s an illustration of the process while accessing a site (google.com in his example) where a cookie is sent with the first GET request via HTTP, could someone please verify:

a)  This would only happen if the web site is available vi HTTP and HTTPS and a redirect is sent upon the initial GET request from client and where HSTS is not in place (and I have a cookie for that web site already on my laptop), right ?
b)  In a scenario where I’m accessing the same page for the very first time  from a different computer even without HSTS enabled , there’s no risk because I don’t have a cookie from the web server yet, so no cookie will be sent with the initial HTTP GET request, correct ?
c)  Quoting from https://news.netcraft.com/archives/2016/03/17/95-of-https-servers-vulnerable-to-trivial-mitm-attacks.html

  Because HSTS directives are delivered via an HTTP header (over an HTTPS connection), HSTS can only instruct a browser to only use HTTPS after the browser's first visit to a secure website.>

But wouldn’t this create a door for MiTM attacks and cookie hijacking in case ONLY when the web server does not send a redirect to the client but continues via HTTP? I mean in the initial client GET HTTP request we’re not sending any cookie, the server sends it, so wouldn’t the web server send it via HTTPS to the client ?

Thanks

T

If you are visiting a web page for the first time, even if it uses HSTS, you are at risk of MiTM attacks as the initial connection is made over HTTP and tools like sslstrip can be used to exploit that (by basically forcing you to stay on HTTP). But if you have already visited a page before and your browser is aware that that is a HSTS page, than sslstrip will not work.

Most major browsers even have preloaded lists of some HSTS sites, which means that even if you visit a site from that list for the first time, you are protected against MiTM attacks.


Is it good or bad to use group in sudoers file instead of using aliases? I have used user groups heavily while designing access control policies. I find user groups very convenient as it's very easy to implement with PAM.

Another reason I have organized the users with various groups is to implement (minimal) RBAC. But when I saw the sudoers file (of the company I am working for) I saw that it's consists of various User_Alias instead of using groups. I got the point of using Command_Alias or Host_Alias but my questions are,

Why use User_Alias instead of groups?
If I want to use group is it good or bad from organizing and security points of view?

Using groups for sudoers entries allows you to manage filesystem permissions (which by default are user- and group-based) in the same place as sudo rules. Using User_Alias instead of groups means all aspects of sudo rules are in the same place but makes it more difficult to manage sudo rules in the same space as filesystem permissions. So it's basically a trade-off; neither method is objectively "good" or "bad".

On balance, because my current environment works this way, it seems easier to use groups to manage both sudo rules and filesystem permissions as part of a wider role-based authorization mechanism. Ideally these authorizations would be distributed via a system such as LDAP, and would manage the groups and the sudo rules on all your servers. The security properties of the system would be dictated by the authorization system as a whole, not just your sudoers files.


Extracting packets from a network without being directly connected to it? If two access points are within close proximity of each other, and running on the same channel as one another, can data be captured from access point A by an attacker on access point B?

I know if A and B are both close and on the same channel it causes interference, almost like an entanglement of the two networks. If this interference occurred would someone be able to capture the network traffic from the opposing networks machines?

I know its a weird question but a friend had an issue where his neighbors network was on the same channel as his and he was able to see his neighbors devices from his network. He thought he was hacked at first, but after doing some tests he realized his neighbors router was broadcasting on the same channel. He switched channels and the unknown devices dissappeared. Could an attacker exploit this?

No. What you describe is not a weakness and also the channels don't matter in terms of security. With airodump-ng you can immediately see all access points in your proximity and also the devices connected to them. This requires absolutely no technical skills (I might be wrong. Some people don't manage to set their network device into promiscous mode ;-)). The point is simply that on OSI layer 2 (802.11) the header information is not encrypted so you can easily see which MAC address belongs to which AP. This is not a matter of concern. I believe using the same channel as another AP in your environment might affect the availability or reliability of your network, but security is not a problem.


How to map a network passively with wireshark dumps? I'm currently diving into network mapping and thought that in order to do this stealthily why not listen to the existing network traffic; a wireshark dump usually contains a metric ton of information - you have at least info on hosts which are up and some ports where communication is obviously taking place. I would like to extract this information from a wireshark dump and get the info in some tool like zenmap or the Metasploit database (hosts/services)

I googled this with "passive network mapping" and "passive network discovery" together with "wireshark" and "zenmap" but didn't find anything. Is this not a thing or am I searching wrong?

If there's nothing I would start with a Python or Ruby script doing this, but I really thought there might be something existing already.

Thanks

Some background information for context : Some organizations save full-packet captures for their high-security or production networks. There are commercial products which do this too. People definitely do what you are talking about but not always for the reason you mention although that's a good side benefit. Ideally what you want is an optical tap at key (ingress/egress) control points on your network. Then setup tshark (text-based wireshark has slightly better performance) to automatically grab the relevant data you want and save .PCAP info for you to parse. This is frequently done to find APT and malware communications but it has a large number of other uses.

That said, I think one of the reasons people don't do this as a primary means of network discovery is simply because some devices may rarely, or never, communicate via the ingress/egress point so it won't always result in 100% accurate information. What you are talking about is somewhat similar to "Passive Vulnerability Scanning" so you may find other very valuable uses for the data you collect in this process and it would be very effective at mapping all the communications leaving an organization but it does have a few limitations.

In a nutshell I think people don't call it "passive network mapping" and "passive network discovery" (both are great names for what you mentioned) because once you get that data you'd realize you can do so much more with it that you're more likely going to refer to it in the larger sense of what it is which comes back to "Full packet capture". I know these aren't exactly the same, you are talking about just collecting some of that data and using it for mapping but I think that is why its rarely called by the terms you mentioned (answer to your question).

Note: NetFlow data would also be another source to passively collect the data needed for mapping and there are a lot of other ways to do this (switch cam tables also work depending on the network). However on very large networks full-packet capture becomes challenging quickly whereas NetFlow data is a little more compact.


Securing anonymous website posts Can a website allow users to securely post anonymously, while still allowing these posts to be edited by the original author at a later time and preventing editing by other users?

In this context, 'securely post anonymously' means that an attacker with full physical server access after the fact (eg. government seizure) cannot determine which user authored a given anonymous post.  I've been unable to find an algorithm that meets these requirements.

My first thoughts:

When any user logs in (regardless of anonymous activity), hash(password+salt 1) is used for user authentication as normal and hash(password+salt 2) is stored in memory on the server as an 'anonymous key' while the user is logged in (never written to storage).
When a user creates an anonymous post, hash(post ID + anonymous key) is stored as the 'ownership token' for the anonymous post.
When a user wants to edit an anonymous post, the system authenticates ownership by repeating the ownership token generation process and checking if the result matches the existing token.

Note that:

An attacker cannot search for the author of an anonymous post without capturing the author's anonymous key from server memory while that user is logged in.
Since post IDs are unique, each anonymous post will have a different ownership token even if they are created by the same user, so an attacker cannot determine which anonymous posts share an author.

Detriments to this algorithm:

A user wishing to post anonymously must have a normal account on the system.
A user's profile cannot link to their anonymous posts, as the system does not store this linkage.  The user must remember and find the post via some other means and ask to edit, at which time the ownership check will be performed. This distinguishes this question from a similar question where profile linkability with anonymity was the goal.
When changing a password, a user would need to either tell the server about all anonymous posts so that the ownership tokens can be updated, or loose edit access to those posts permanently.
An attacker with admin access to the system while it is running would be able to log the anonymous keys of users as they log in and later use these to break anonymity of the ownership tokens.

Am I missing any big things that would make this insecure under the definition of 'securely post anonymously' above?
Is there a better (simpler, more secure, or fewer detriments) system for this?
Does any algorithm for something like this already exist?

I suppose you could add something like the following to appear below an anonymous positing (only in the session of the editor, of course)

  If you later want to edit this post, please use the following information:

  postid = 123456, authentication = iufdhgoieroertz3147493532v

  or use this link directly:
  http://example.com/anon-edit.php?postid=123456&auth=iufdhgoieroertz3147493532v

  You may want to save this information and/or link locally in a safe place for later use. Please do that now because it will not be possible for you (or others) to reproduce this later.
  When you try to edit a post via the "Edit" button, you will be asked to enter the authentication code above. Note that each postid requires a differnet authentication code.

Of coures, the 123456 here is the internal id of the post and iufdhgoieroertz3147493532v is a unique random string stored with the post, but never output (except immediately after successful edit as written above).

An attacker cannot guess the authentication without access to the local storage the user chose, or access to the parameter value during transmission, or access to the posting database.

Some of this could be made more transparently with cookies and/or local storage, but people sufficiently interested in anonymity against government seizures may not be happy with cookies and local storage either.


Should I decode a base64 password before hashing for storage? My server gets base64 encoded passwords from the client, and I am going to hash them for storage in a credentials table.

Should I decode the password and hash the clear text password, or just hash the encoded string?

Theoretically, decoding or not decoding does not matter, because Base64-encoding is a public permutation (every sequence of Base64 characters can be decoded, and reencoded, by everybody, and this is deterministic). If Base64-encoding strengthen or weakens your password hashing function, and your password hashing function is poor and weak and should be replaced with something stronger.

In practice, some password hashing functions have limitations; in particular, most bcrypt implementations accept passwords of size up to 51 or 55 bytes, no more. Since Base64 encoding increases the data size (every 3 bytes yield 4 characters, reencoded as 4 bytes), hashing the Base64 encoding implies a lower maximum password size. For that reason, it is advisable to decode the Base64 and process the raw password.

However there is also a good reason not to decode the Base64, depending on your support library. If your password hashing implementation uses strings as input, then that code necessarily does some character-to-bytes encoding. This can imply some very inconvenient encoding issues, especially with non-ASCII characters (a simple latin-1 character like "é" has several representations in Unicode, yielding different byte sequences). It is important that this encoding is deterministic (when the password is verified, it should use the same encoding as when it was initially chosen). When you receive Base64, then the caller already did the job and presumably agrees with himself. Therefore, it is advisable not to decode the Base64, and instead to hash it directly.

Or maybe not. An alternative view is that encoding issues call for systematic processing, and it may be a good idea to systematically decode everything you receive, to ensure reencoding with the same rules (the encoding rules on the server). This might actually help if the user employs different kinds of client software, with different encoding rules.

So, really, it is up to you. Personally, I would decode the Base64, because I trust me more than other people to process Unicode strings properly, and it avoids artificially lowering the maximum password size in case the hashing function is bcrypt (other functions like PBKDF2 do not have such limitations).


DNS cache poisoning in LAN without MITM Many questions have already been asked about DNS cache poisoning (aka Kaminsky attack), however I couldn't find a clear answer to my question:

Is DNS cache poisoning possible in a LAN, without executing a MITM attack?

Clarification:

It is normal that DNS cache poisoning is possible during a MITM attack.

However, I don't see many topics revolving around a technique to cache poison a LAN, without executing a MITM attack (like the Kaminsky attack). I think it should be possible, as all DNS requests/replies are plain http, unencrypted. We should thus be able to see the request (including the transaction ID and exact port), and prepare a fake answer before a 'good' DNS server can answer the request. The attacker is on the same LAN as the target, and will thus be much faster to response than another DNS server outside the LAN.

Is such an attack possible? I understand that it is easier to perform DNS spoofing during a MITM attack, I just want to know if it would be practically possible to cache poison clients on a LAN by winning the DNS response race without having executed a MITM attack.

Note: this is not a question about how the Kaminsky attack was prevented (transaction ID and port randomization)

DNS requests and replies are not HTTP; they are... DNS. See the standard. Most of the time, DNS requests and responses use UDP: the request is a single IP packet, and so is the response.

With UDP, each packet is identified by:

the source IP address
the destination IP address
the source port
the destination port

A DNS request from client C to DNS server S will use C's IP address as source, S's IP address as destination, a random port value p as source port, and 53 as destination port (the standard port value for the DNS server). The DNS response will use C's IP address as destination, S's IP address as source, 53 as source port and p as destination port. The client will accept the response as "correct" because it uses p as destination port, the same p as the one used by the client as source for its request.

An attacker who wish to feed fake DNS information to the client C can know C's IP address and S's IP address, and can make a good guess about the moment the client will send its request. The attacker's goal is to send a fake DNS response, claiming to come from the DNS server S, but containing. Without full eavesdropping access, the attacker cannot know the value of p, because he cannot see packets. However, port numbers are in a limited range (port numbers range from 0 to 65535, but the actual range for randomly allocated numbers is smaller, and depends on the involved operating system). Therefore, the attacker may just send a few thousands of spoofed IP packets, each containing the fake information, for all possible port p values. The client will drop all of them except the one using the correct p value.

The same concept can be extended to communications between DNS servers, because they talk to each other, and cache responses. It is often easier to pull off for the attacker, because he can trigger himself the DNS-to-DNS exchange, allowing a precise timing for his launch of his thousands of spoofed responses. When he succeeds at feeding fake information to a DNS server, then that DNS server is said to be poisoned.

This sort of things is relatively easy even for low-tech attackers who don't have eavesdropping abilities, let alone interception power as would be required for a true MitM between the client and its DNS server, or between DNS servers. The reason which makes it easy is the use of UDP, which implies that the attacker knows everything except the random source port, which lives in a small range. If the two DNS servers talk to each other over TCP, then the attack is more difficult, because injecting fake data in a TCP flow implies guessing the connection sequence numbers, which are randomly chosen in a 32-bit range: the "thousands of packets" have become "billions of packets".


protect c ++ application via an automatic hardware binding I have a Qt App which is running on a raspberry pi (Debian Wheezy).

The raspberry image is autogenerated via a python script:

- Get the latest version of the generic custom-raspi-image
- Mount the image
- Copy project specific program data into place
- Setup systemd services for automatic setup
- Unmount the image
- Write the image to a sd card

On first boot, the disk size is expanded and some startup settings are set. Now on this startup routine, I would like to "brand" my app into the sd card. So that no one can just copy the sd card and use it in another raspberry. I must have an automatism.

The idea is compiling a c++ dll (on startup routine) which has the internal CPU id as a constant. Afterwards delete the "create c++ dll" script and move the dll into the app folder. The app is calling a function in the dll file and submit the internal CPU Id. Depend on true or false, the app is starting or not.

Is this the right way or do you have a better solution?

Someone with a debugger (like gdb, or anything else that can use the Linux Kernel's tracing capabilities and can utilize binaries)  will have an easy time figuring out how to circumvent your copy protection.

You'd have to encrypt your binary (that's possible), and use some machine-specific secret (e.g. the CPU ID, TPM chip data) to decrypt it. Problem: you mustn't leak that info, otherwise anyone can decrypt the binary. And protecting a CPU ID of the ARM in the Raspberry Pi isn't really feasible if someone has the possibility to e.g. run a shell, or access any scripting language. Also, you'd need to be very careful – once decrypted to RAM, you can actually dump the unencrypted machine code and presume operation later on. So that's not secure, either.

Anyway, if you do this, and hand out these SD cards or RPis with such software, you're probably breaking the GPL and other licenses that you're using – many of these copyleft licenses require you to include or at least make accessible the source code of the software you're distributing, and allow them to copy that code and the software. Qt is dual-licensed under a commercial license (for which you'd have to pay, but which would possibly allow you to not distribute the source code) and GPL.

Your copy protection scheme is weak – it's based on a secret that is, in fact, not a secret.

I don't know about trusted platform modules (TPM) in the RPi class of devices – but effectively, if you want to bind some software to hardware, the hardware needs to have the ability to decrypt something based on a unique key that is actually, truely kept secret by the hardware. As far as I can see, your devices don't have such.


Can plugins for text editors and IDEs be malicious? I'm always a little cautious about plugins I install for text editors or browsers, but can they be dangerous and cause the text editor or browser to behave in a malicious way?

For example, can a plugin for Atom or Firefox read files and delete them? Or access and send them to an unknown attacker?

How can one avoid installing such plugins?

Plugins affect the way that the software behaves. So, it would be possible to write a plugin to do something malicious. And it's not just IDEs or text editors, but browsers or any software that allows plugins could be affected.

You also have to define what you mean by "malicious"? Can a plugin act as a remote access trojan? Probably not, but that depends on what the core software can do and what capabilities are exposed by the core software. Can a plugin modify or delete files maliciously? Of course.


Prevent injection in PHP file Recently I wrote this code:

<?php
$path = '../data/about.html';
$handle = fopen($path, 'w') or die('Cannot open file:  '. $path);
$data = $_POST['name'];
fwrite($handle, $data);
fclose($handle);
header("Location: warnings.php")
?>

I heard that this code is vulnerable to XSS injections and null bytes. How can I make it more secure? Note that the files I wrote will later be used with AJAX on pages, so I need it a way I can decrypt in JS if I need to encrypt files.

This looks like something that needs to be redesigned entirely. The main issue is that you are allowing the contents of the about.html file to be written to via a web request.  The user can submit a request will allow them to render arbitrary html.

Can the markup in about.html be templated? If so, then you can escape the fields for the appropriate context (attribute vs. element), but as it stands right now there is not a good way to secure this code.

Edit for clarification:
It sounds like you may need a better understanding of what Cross-Site Scripting (XSS) is.  XSS is acutally a terrible name for the vulnerability.  What is really occurring is client side code injection.  More information is available here: https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)   The heart of an xss vulnerability is the fact that an attacker can control what the user's browser (render markup and execute arbitrary JavaScript).

The issue with the current implementation is that you are trying to let a user write an entire html document.  With your solution, the user needs to be able to write some html, but should not be allowed to write malicious html.  This is extremely difficult to do correctly. Escaping the html (using htmlspecialchars, in this instance) being a part of the correct solution, but I don't believe it it will work with the current implementation. A much easier solution would be to template out the about.html file, and escape all of the data that the user is passing in.  This way none of the markup will be controlled by the user.


Skype Audio / Video Session over VPN? Basically I'm wondering if a Skype video session along with audio could be logged (or recorded) over a virtual private network? I know whoever hosts the VPN server can log which websites you visit (or how often you visit them) along with other sensitive material such as user names, passwords, emails, and bank account numbers but can they watch your video session along with hearing audio feedback?

Could they do this in real-time as well?

It'd be actually pretty freaky to know this. Thank you for your time.

Skype encrypts all traffic.

https://support.skype.com/en/faq/FA31/does-skype-use-encryption

Your VPN provider can record this traffic, but I think they won't be able to decrypt it.

However... Skype itself is able to decrypt this. Since MS took over, all traffic is directed over their servers, and they have the keys used for encryption. In the old days, once the connection was setup, traffic was between sender and receiver directly, which was much more efficient, but less convenient for certain US agencies.


Server authentication during the SSL handshake I have question regarding the server authentication during the SSL handshake.

I am going to write this up as my understanding of the concept. Please feel free to point out any mistakes.

We generate a CSR on the server which includes the public key of the server along with the ID information of the server. The CA verifies the identity information after series of steps and generates a certificate which is also signed by the digital signature of the CA server.
My first question here is that what comprises of the Digital signature of the server.Does it use the values in CSR; i.e take a hash and encrypt them to generate digital signature or this process of digital signature is individual to the CA.

Secondly during the SSL handshake this certificate is presented to the client. Now in order to verify this certificate one of the steps would be to make sure that issuing CA’s public key validate the issuer’s digital signature.How is this step performed?

My first question here is that what comprises of the Digital signature
  of the server.Does it use the values in CSR; take a hash and encrypt
  them to generate digital signature or this process of digital
  signature is individual to the CA.

Part of the X.509 standard (standard format for public key certificates) is that certificate signature algorithm can be specified by the signing party. Wikipedia for instance has a cert where SHA(-256) with RSA was used to sign the cert (this method is very common):

SHA with RSA basically works the way you expected it. It takes the contents of the cert, throws them through a hash function (SHA) and then signs them via the RSA private key. Written out, if C is the cert, then the signature S is computed as S = (padding || SHA(C) ^ d mod N where padding is a secure padding scheme for RSA, the private RSA key is d and the public RSA key is (N, e).

  Moving on, on lets say during the SSL handshake this certificate is
  presented to the client. Now in order to verify this certificate one
  of the step would be to make sure that issuing CA’s public key
  validate the issuer’s digital signature. How is this step performed?

Using the above case as an example, say I have a signature S for a cert C. Recall that (N, e) is the public key of the CA. The way I would verify the signature is to calculate V = S ^ e mod N (with the padding stripped). In other words I verify the signature with the CAs public key. I would then check if V = SHA(C). If this is the case then the signature is valid. For further details see also How does RSA signature verification work?.


Cracking less than 4 letter linux password using john I am trying to crack a less than 4 character Linux password using john. I unshadowed my password into file.txt I use the following command:

john -incremental file.txt

the output is:

0g 0:00:00:04  0g/s 1226p/s 1226c/s 1226C/s sonkys..michot
0g 0:00:00:05  0g/s 1259p/s 1259c/s 1259C/s 083078..115269
0g 0:00:00:06  0g/s 1275p/s 1275c/s 1275C/s samil..shite
0g 0:00:00:07  0g/s 1285p/s 1285c/s 1285C/s juaps..jight
0g 0:00:00:08  0g/s 1291p/s 1291c/s 1291C/s marali..morie1

looks like it is using a password list instead I want to start from 1 word password and then 2 words and so on.

John will default to its internal wordlist. Sounds like you need to use mask mode:

./john --mask=?1?1?1?1 -1=[A-Z] file.txt -min-len=4

This example will attempt all permutations of 4 character, upper case A-Z letters.

Other options:

   ?l lower-case ASCII letters
   ?u upper-case ASCII letters
   ?d digits
   ?a full printable ascii

There are a lot of ways to configure mask mode including combining masking with a wordlist if thats what you want, read the documentation here: https://fossies.org/linux/john/doc/MASK

Also are you sure your password is not salted?


What is the right way of storing database connection strings from the security point of view? What are recommendations, best practices and have-to-dos regarding handling connection strings in web applications? What things one should never, ever do?

Best option: Don't use a password for the database, but instead employ (Windows) Integrated Authentication if it's possible, and of course isolate the application's identity that is authorized for the database. That way you have the OS/Webserver/SCM manage your identity, in a very secured manner.

If it's not possible to go the way of Integrated Windows Authentication (IWA), you'll need to securely encrypt the connstring, preferably using something like DPAPI (so you dont have to manage the encryption key), and store the encrypted value in a protected Registry key with strong ACLs.
If you are on ASP.NET (from your comments, but not OP), there are built-in tools to do this automatically (aspnet_setreg, aspnet_regiis, etc depending on version...)


What is being verified in OpenSSL's SSL_get_verify_result In OpenSSL the following function is used to verify certs.

SSL_get_verify_result

I looked at the manual here. But it does not detail what is being verified. Can you clarify to me what does this function verify? (e.g. expiration date, trust chain, etc.). It is important to me to know how the result is generated exactly and what are the factors that the verification is built on?

SSL_get_verify_result() doesn't actually do any verification; it returns (part of) the result of the cert verification (if any) done during the most recent full handshake (if any) on the given SSL object. Assuming you really want to know what that verification did, it depends a good bit on the application code.

If the code sets a callback with SSL_CTX_set_cert_verify_callback before creating the SSL object, then the verification during handshake consists entirely of calling that callback -- whatever the callback does is what it does. If this callback is not set, as the man page says, a 'built-in verification function' is used, which is actually X509_verify_cert() (which has its own not very helpful man page) and what that does is roughly what is described on the verify(1) man page as referenced by John, plus some things that have been added over time but didn't always make it into the doc (e.g. NameConstraints and DANE, not to mention some revocation checking), but this checking can be altered and 'tweaked' by numerous options and parameters, not all of which are usable for verify(1), and most settable at either the SSL_CTX or SSL level, including an optional 'verify_callback' which is separate and quite different from the 'cert_verify_callback' mentioned above. See the man pages for SSL_[CTX_]set_verify[_depth], SSL_[CTX_]load_verify_locations et rel,
the X509_STORE_* and X509_STORE_CTX_* functions including X509_STORE_CTX_set0_param and related X509_VERIFY_PARAM* functions especially X509_VERIFY_PARAM_set_flags.

And if that's not exact enough, and it may well not be, check the source -- for the version you are (or will be) running, since there have been some changes in this (quite complex) area over time. Explaining exactly everything it does, even in a particular version, would (almost certainly) exceed the Stack answer limit and would take me about a week, as well as likely becoming obsolete soon, so I won't do that. If you have one or a very few specific issues, that could be answerable in a practical amount of time.


Is piping a `ssh-agent` signed message as a password secure? There's an encrypted filesystem on a server I ssh into using public key authentication. Since a forwarded ssh-agent can deterministically sign a message (see also the ssh-agent protocol section 2.6.2), I consider using a message stored on the server combined1 with its signature (using a private RSA key stored on the client via the forwarded ssh-agent) as password piped to the encryption program to solve my question How to decrypt an encrypted container via ssh without entering a passphrase while requiring some client authentication? (but basically any password prompting application could be involved here) and then discarded again. But is this a good (=secure) idea? What kind of combination between message and signature should I actually use? Is there a need for using a different key pair than for the ssh authentication? Or am I trying to invent a triangular wheel?

1 Does combining the original message with the signature actually help in any way compared to simply using the signature alone? (Apart from entropy, but assume key stretching is applied anyway)

Here's a short summary of how SSHv2 public key authentication works:
sshd on the remote server expects the client's ssh or ssh-agent to sign a predetermined message with its private key (that is not stored remotely) and the server can then verify it via the forwarded public key and check it against the user's authorized_keys database.
ssh-agent-forwarding now usually consists of connecting to a third PC. The intermediate PC generates the message, but asks the original client's ssh-agent to sign it, without ever getting to know the private key itself. This very same signature instruction is what I want to use to obtain a "secret" (the signature, not the public key) that can be used as a password that is not stored anywhere (and cannot be reproduced on the client alone if the message-to-be-signed is stored only on the server) - no third PC involved, only the agent forwarding.

Here's an illustration of the process I intend to implement:

Client:                   Server:
>ssh-add SECRET RSA KEY
>ssh -A server            <-- connect, forward agent (authentication does not
                                         need to use that specific secret key)

                          Connect to the `SSH_AUTH_SOCK` unix socket and ask
                          the client's ssh-agent to sign MESSAGE with SECRET RSA KEY
                          (knowing only the respective PUBLIC RSA KEY to identify it)
ssh-agent signs MESSAGE --> SIGNATURE
                          [optionally verify SIGNATURE]

                          Use SIGNATURE as PASSWORD,
                          pipe that to the program and forget it.

To my understanding this implies the following:
Should the server be stolen, the thief would have to intercept the client signing MESSAGE, otherwise they can't obtain PASSWORD. Should the client be stolen, without MESSAGE not even SIGNATURE can be generated. Thus both server and client need to be stolen and the passphrase of the SECRET RSA KEY be obtained - brute forcing of which would be just as annoying as brute forcing the original password itself...

edit I wrote a small Python script for this, ssh-agent-sign

It's no less secure than entering a password over SSH to decrypt the container.

Whatever decrypting a container on a remote system is secure at all is completely different problem.


My ISP uses deep packet inspection; what can they observe? I found out that my ISP does deep packet inspection.
Can they see the contents of HTTPS connections?  Wouldn't having HTTPS ensure that they can't see the contents being transferred?

And can having a VPN protect me against deep
packet inspection by ISPs?

Deep Packet Inspection, also known as complete packet inspection, simply means they are analyzing all of your traffic as opposed to just grabbing connection information such as what IP's you are connecting to, what port number, what protocol and possibly a few other details about the network connection.

This is normally discussed in contrast to the gathering of NetFlow information which mainly collects the information listed above.

Deep packet inspection gives your provider a lot of information about your connections and habits of Internet usage. In some cases, the full content of things like SMTP e-mails will be captured.

HTTPS does encrypt the connections but your browser has to make DNS requests which are sent primarily via UDP so that data will be collected as will any unencrypted links or unencrypted cookies sent incorrectly without https. These additional bits which will be collected may be very telling about what type of content you are looking at.

The larger concern for most people is about data aggregation, by collecting this information a data scientist could create a fingerprint for your Internet usage and later associate with past activities or activities from other locations (when you are at work or are on vacation). Likewise, your service provider may choose to sell this to any number of organizations (possibly including criminal organizations) where it could then be used against you in ways. In many countries, people have an expectation that their communications are considered to be private and collecting this data very much goes against that privacy expectation.

Another interesting aspect of this is in the cases like the US where this data may soon be sold it allows International communications sent to people, or servers, in the US be sold as well. Likewise, this could potentially allow every agency from local law-enforcement, military, tax authorities, immigration authorities, politicians, etc. a way to bypass long-standing laws which have prevented them from accessing this type of information, or important informational subsets within this data otherwise.

A slightly different concern when this data can be sold is competitive intelligence / corporate espionage. In the scenario where a company does a lot of research-intensive work at their headquarters located in some small geographical location (think of pharmaceuticals or a defense contractor) selling that data makes it possible for anyone to buy all of the traffic from the local ISP where most of those researchers live and analyze what they are looking for when at home, possibly even directly from the ISP hosting the traffic for their corporate headquarters. If other countries aren't selling similar data it gives foreign companies and companies wise enough to try and buy this data a huge technical advantage. Likewise, it would also allow foreign governments to buy ISP traffic which includes the data from US (or other government) Officials homes.

Imagine companies monitoring their employee's behavior at home or on their mobile devices.

This will likely have a chilling effect on activists and whistle-blowers as well.

Likewise, if credit cards or PII are sent in the clear to a poorly secured remote site your ISP's data set now has a potential PCI or PII regulatory issue on their hands. So this amplifies data-leakage problems of all types by making additional copies of the data leaked.

With the examples I've just mentioned above, and there are hundreds of others, it should be easy to see why this type of data collection has a different level of importance to it than just metadata or basic connection information. Even if your ISP never sells this data they are collecting quite an interesting dataset.

It's a security issue that definitely has a lot of potential long-term security implications.


Multiple Intermediate Certificates on openssl I need to create multiple intermediate certificates so the chain would be like this root >> int 1 >> int 2 >> user cert.

Till yet, I have created a root and an intermediate certificate (signed by root) and one more intermediate certificate (signed by the previous intermediate). Now, what would be the next process ?

If there would be single intermediate then the below mentioned command will be used.

openssl pkcs12 -export -out ia.p12 -inkey ia.key -in ia.crt -chain -CAfile ca.crt

Since, i have two of them, how will the command work ?

Any help will be appreciated.

From the documentation:

  FILE CREATION OPTIONS
  ...
  -in filename
  The filename to read certificates and private keys from, standard input by default. They must all be in PEM format. The order doesn't matter but one private key and its corresponding certificate should be present. If additional certificates are present they will also be included in the PKCS#12 file.

In other words: all the certificates should be inside the file given by the -in argument.


secure IoT device/brand publication I came across this article: 75 Percent of Bluetooth Smart Locks Can Be Hacked when I was looking for IoT stuff for my home.

tl;dr is they tested 16 bluetooth smart locks and eventually only two were hack proof (as of the last update). The two left were padlocks.

Are there any resources/groups that have something like the above article, but not limited to smart locks? All I've found are articles that say so and so device security is bad.

What I'm looking for is to make my house smart, but not easily hacked. I'm trying to do so by looking for a site that reviews the security of IoT stuff and gives them a score. There are a few groups that are working on five star ratings or certifications but I'm not aware of anything that is already published.

I realize this sounds like a list question, but I'm not asking for recommendations. I'm looking for a trustworthy resource I can lean on for good information. If this isn't the right place to post this, some direction to where it would be on topic would be appreciated.

There are a few folks doing IoT security reviews, but not too many of them out there just yet. Matthew Garrett has gained a bit of noteriety for reviewing a few products:

http://mjg59.dreamwidth.org/tag/advogato (reviews are in among other posts and also posted to Amazon)

Some of them to amusing effect:

https://www.theverge.com/circuitbreaker/2016/7/5/12096520/bad-amazon-review-product-pulled-auyou

Several vendors are trying to hawk snakeoil products to protect you from the scary IoT devices in the meanwhile. Hope they work on microwaves too:

https://us.norton.com/core

https://www.bitdefender.com/box/


Bank website forwards to false site - formatted hard drive - still forwards Summary:

When I visit my bank's website, I get forwarded to a phishing mirror site.

This has persisted through a re-format of my MacBook.
Even on different browsers!
Other computers on the same network do not have this problem, so I don't think it's the router.
Visiting my bank site through a VPN works fine so it doesn't seem like a virus either.

What could be going on here?

Full Story:

A few weeks ago my bank account was hacked. I had typed in the url to my bank's website and was forwarded to a mirror site without noticing, where I stupidly put in my account details. This was using Chrome on an MackBook Pro. I went to the bank to lodge a fraud claim and they said it must be my computer because nobody else has reported this problem.

I formatted my laptop by following these instructions: http://smallbusiness.chron.com/reformat-macbook-53599.html

I went back to the bank's website and was still forwarded to the mirror site! (Now that I'm looking for it, I can tell because the url is slightly different and not https). So I tried on different browsers, because I remembered that in the past this bank used digital certificates, so maybe there is one saved in my chrome settings somewhere that has been compromised. (I tried anonymous browsing, plus Safari, and even downloaded and tried Epic browser) and still I get forwarded to the false site!

On my brother-in-law's laptop on the same router/LAN, it goes to the proper bank website with no forwarding.

But if I visit the website through a VPN, it doesn't forward me to the false site! What the heck?? Is there a virus on my computer? Surely if it was local, the VPN would make no difference? But if it was at the bank's end, then it wouldn't be happening to just me! I'm confused and worried about my online security now. Can anybody shed any light on what might be going on here?

UPDATE:

First thing I did was ping the bank's URL from ping.eu and it returned an address that starts 186... When I copy this IP into my URL bar, it says "the site can't be reached. [IP Address] took too long to respond"

Then I pinged the same URL from "network utility" on my macbook, and it returned a different IP address! When I copied this one into my URL bar, I got a chrome page saying "Security error! Deceptive site ahead".

My dns server is listed as 192.168.0.1 - totally normal right? So it's the router? But my B-I-L's laptop doesn't have the issue?
What does this mean?? And what should I do??

Another update:

After the help you guys gave me on router and dns problems I googled "how to detect mitm attack". I checked the dns settings on the router, and it has the "use these dns servers" box ticked, with two random IP addresses filled in. I unticked the box, went to my bank's website and voila! No phishing site.

So they hacked my router? I didn't even know that was possible, but now that I think about it, it is remotely accessible on the LAN and the username/password is the manufacturer default. Will a hard reset of the router and then changing the username/password be sufficient now?

Another question is, how did they gain access to my router in the first place? Should my BIL also format his laptop in case it was a virus?

One common attack method consistent with your symptoms is DNS Hijacking, which is any means that an attacker uses to convince your computer that your bank's web site, "www.mybank.com" is actually at an IP which is a server under their control instead of the IP under your bank's control.  When you type this into any browser, it heads for the malicious server which then shows you a page much like your bank's own page, expecting you to log in without knowing the difference.

A compromised router could cause your DNS requests to all flow through it and therefore be replaced by malicious IPs when they are returned, while using a VPN would bypass it and show you the correct site. Also, another device on your network might not use the local router as its DNS server which could also cause it to not fall for the same router based attack.

To tell if its a DNS issue, from the affected computer try to ping the basic hostname (first part of URL) for your bank, see what IP comes back. Then check that IPs ownership on a site like arin.net, if its not owned by your bank or by a reputable CDN provider, boom you know you have a DNS highjack going on.

You can also test it by pasting the found IP into your browser bar and see what happens, but since your browser might show you a page that looks just like your bank's site, it is not conclusive unless you thoroughly look through the TLS certificate info to ensure it really is your bank. Another possible outcome is it will flag the new site as malicious (if it tries something like showing you a TLS encrypted page with an invalid certificate) but that is also not guaranteed to happen.

Edit: more about router compromises

The attacker has a few possible ways to coerce your router to doing something you don't want: they can simply log in remotely which is especially easy if the router is exposed to the internet (many are) and the credentials are the default (many are).  Both of these should be avoided at all times.  Some routers have had firmware exploits that allow an attacker to bypass the password; updated firmware should be sought and applied on a frequent basis.  Browser based exploits are also possible: a piece of malware in a site, an ad, etc. will go after default IP/credentials of your router, bypassing external access restrictions by using your own computer to do it, and then script a change like setting DNS servers to malicious ones.

Another simple mitigation to primitive router settings hijacking efforts like this is also to simply set your computer up to use a specific DNS host, like the venerable 8.8.8.8 (google's highly available anycast-based DNS server network) which is still possible to hijack if your router is 100% compromised and all port 53 UDP traffic is redirected, but more simple attacks like settings cannot do this so it would be effectively blocked.


How can IT audit for installation of IIS Express? IIS Express is a developer tool for Windows XP and higher which provides the full feature set of IIS, but without needing administrator rights.

I've seen discussion by some developers who are considering bundling this with their application to make deployment consistent among versions.

If you read the comments section in the link above, the blogger ScottG (and MSFT Corporate VP) mentions that instances of IIS Express will not receive updates via Windows update, but they might be updated when using Microsoft Update.

Since having unexpected and unpatched deployments of IIS Express in the environment of the application end-user can be an attack vector, how does their IT Security organization
audit and detect the usage of this product?

The obvious answer (if we accept your premise) is: routinely port-scan your own machines to see if they are running any unexpected services.

I'm not too sure about the premise that the best way to defend against this risk is to try to detect use of IIS Express.  I wonder if you have considered an alternative approach, which is not specific to any particular product:

Developers should have full control over their machines, but those machines should be firewalled from the Internet.  There should be no open ports that are reachable from the outside Internet, without approval from security staff.
There should be separate machines for deploying services to the rest of the world.  These machines should be under control of the ops folks, and the ops folks should have procedures governing which services they deploy on those machines.  The ops folks will probably require some form of change control, if they're good.  These machines can also be firewalled with a firewall policy that matches the expected services running on those machines, as a safety net to catch mistakes.

I think these two steps will take care of the problem.


ssl+symmetric with my own encryption algorithm? I am a final year student currently doing my project, the title is "Mitigating man in the middle attacks using ssl+symmetric key algorithm". I would like to create my own encryption algorithm. I need to know that could I write it in C, and how to generate an ssl key and to write an encryption algorithm and then to combine them both?

It is possible to add a symmetric crypto algorithm to OpenSSL.  There is an example algorithm called GOST included in modern OpenSSL distributions; this page talks a tiny bit about integrating it from a separate package, which would be a good first step for you if you want to learn how to integrate your own algorithm.

That being said, while this would be a useful and interesting learning tool, never implement your own crypto algorithm for actual secure use.


Do we need to set the X-Frame-Options header for JS files too? I have added the X-Frame-Options header for my HTML files from web server itself. Do I still need to add it for other static files like CSS and JS( which I serve from cloudfront/s3) ?

No. The reason we need XFO (or the corresponding CSP frame-ancestors directive) is clickjacking. Clickjacking is not an issue for JS or CSS files, so you do not need to set the XFO header for them. But doing so doesn't really hurt, so to save yourself from configuration mistakes you might as well set it for all resources. It's simpler that way.

It sounds like you are setting the header from the HTML file? If so, here's a note from OWASP:

  Meta-tags that attempt to apply the X-Frame-Options directive DO NOT WORK. For example, ) will not work. You must apply the X-FRAME-OPTIONS directive as HTTP Response Header as described above.


DNSSEC ZSK compromisation (man-in-the-middle attack) Assuming I am administering a DNS zone and I operate an authoritative name server that is secured with DNSSEC (split ZSK/KSK setup).

When the Zone-Signing-Key (ZSK) ever gets compromised, would it be enough to resign the zone with a newly generated ZSK or would the KSK also needed to be exchanged (and the according DS record inserted into the parent zone) as well?

My concern is that a man-in-the-middle could use the compromised ZSK to generate fake records without a resolver being able to detect this, if he simultaneously publishes the old ZSK instead of the new one. I am neither aware of a revoking mechanism for Zone-Signing-Keys nor does it seem possible to also sign a "ZSK key inactive date" with the KSK.

Am I missing something or would the compromisation of the ZSK therefore require an exchange of the KSK, too? Also, what are the main advantages of a split ZSK/KSK setup in this case?

The split ZSK/KSK main benefit is to be able to change the ZSKs very often, as they are under your control completely, while for the KSKs, if you change it, you need to update the associated DS record in your parent zone, which is not always something 100% automated. This is why KSKs have typically 1 or 2 years of validity, where ZSKs are more like 1 month.

In your case, if the ZSK is compromised, you need to remove it immediately from your zone, add a new one which will sign everything else, and make sure it is signed itself by your KSKs.

If your ZSKs is compromised because, for example, it was on an HSM and you have the KSKs at the same place, then if you are paranoid you should suspect that everything may be compromised, which means changing all your keys in emergency, contacting your parent zone, trying to ask major DNS resolvers to flush their cache after your new setup, etc…
Of course same thing if it was a "SoftHSM" setup.

But if only the ZSK is compromised, resolvers will detect it if it used to sign records because your KSK would not sign this ZSK anymore, hence breaking the DNSSEC chain of trust.


Why the big jump in CVE-2017 numbering? Can anyone explain, why the numbering from this years CVE entries jumped from CVE-2017-15xxx to CVE-2017-1000xxx?

What about entries with the numbering sequence CVE-2017-16xxx, CVE-2017-17xxx, and so on?

Why are ~984 000 entries not numbered sequentially?
Reading the official documentation gives me no idea about the answer to this question.

Probably because this missing block was assigned to a CVE Numbering Authorities (CNA): https://cve.mitre.org/cve/cna.html. As soon as a CNA have a vulnerability affecting one of their own products, then those missing CVE will be assigned.

In the CVE details page, you can check which CNA assigned a specific CVE, i.e: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-8811 (Debian did it)


SQL Injection tool (Mac OS X) Do you know any software for searching (analyze) SQL injection (on website) from Snow Leopard ?

I have found some that can run from Linux or Windows.

I understand that most Linux (console) applications could be run under Mac Os x. But is there any GUI based software for that purpose ?

SQL Map is probably the best tool out there. It is on the command line, however, I did find this GUI for it. I haven't used it, but hopefully it will suit your needs.


Why would distributing via Google Play be more secure than distributing APKs? Why do so many Android developers use Google Play to distribute apps instead of (or in addition to) simply putting the APK on their secure website along with a checksum or signature of it?

One of the best security practices is keeping your software up to date. With the Google Play Store, you can set your installed apps to update automatically (if this isn't already set by default).

To keep manually downloaded apps up to date, you would have to download their APKs every time their developers publish a new version. To do this, you would probably have to subscribe to a newsletter or RSS feed, and check your email/RSS reader regularly for updates. This might be an acceptable setup for a couple of apps, but this will become troublesome as the number of your apps increases. Not to mention, you'll probably have to check the signatures/checksums of the apps one by one to verify their integrity.


Hundreds of empty-username logins in Wordpress site A Wordpress site I manage has the WordFence security plugin installed.

Legitimate users occasionally get blocked by the Brute Force protection aspect of the plugin, even though they haven't made any bungled login attempts.

When I look into the Live Traffic I see hundreds of invalid login attempts, mostly at /xmlrpc.php but some at /wp-login.php.

However, they don't look like hacking attempts, since they all use a blank username:

  Mountain View, United States attempted a failed login using an invalid
  username "". https://my_domain.com/xmlrpc.php 5/2/2019 1:00:24 PM
  (22 hours 5 mins ago)

When I look up the IP addresses in WhoIs, it tells me that it's Google LLC.

Has anyone else come across this issue before?

Is it possible that some Google product, perhaps a Chrome browser tool, is inadvertently causing this issue?

Weirdly, when I blocked the IP address range of the attempts in WordFence, I was locked out of the site myself, even though my IP address isn't within the range.

PS: The site uses the W3 Total Cache plugin.

It sounds like something on your site is generating posts to your authentication page (perhaps a bug or misconfiguration) with no credentials. Your brute force protection is picking up on the Auth failures and locking users out.

Then when you visit the site you generated the same empty authentication posts and triggered the same brute force protection and locked yourself out.

So dig deep within your core or perhaps chrome Developer tools and determine where those auth posts are coming from.


Does sudo ever de-escalate privilege while the program/command/service is running? For Example

Is it safer to do:

$ sudo [cmd] [args] [enter user password]

or

$ su - [enter root password]
# [cmd] [args]

I always assumed they are the exact same thing, because sudo utilizes setuid-root, so the process that is run as sudo's first arg is run with the sudo's effective ID, which is root.

my question is: Does sudo ever eventually drops its effective ID to the normal user's?  Then in that case, number 1 above would be a safer bet, because IF the program/service that sudo is running with is compromised by an attacker, then there is a chance that the attacker is not running as root, because the privilege has already been dropped (kind of like a race condition)? But compare to the number 2, then any program compromised while running as root is detrimental.

As far as I know, starting a service with sudo will run the service with root rights. These will not be dropped during the lifetime of the service.

However, if you use su root you switch to root user and every command you issue will be executed as root. This is something you should be aware of and not start other services which do not require root privileges. In that sense it might be 'safer' to use sudo.
But that is more a user/administrator risk.


.net System.Security.Principal.WindowsPrincipal user namespace ldap injection A recent scan of a .net web application detected an ldap injection vulnerability for a field that was used for a username assigned to an instance of a custom class named User.

After stepping through the code, I found that the User instance was given the System.Security.Principal.WindowsPrincipal instance, and did in fact send an authentication request for the supplied username to the hosting computer's IIS server, appearing as a logon event in the Security logs.

I haven't yet been able to consistently get a response for the injection for both positive and negative ldap query results, but it seems very possible, and I'm working to get another scan with the same results, having some trouble, but haven't reached a wall yet.

Validating against a whitelist will prevent the classObject string from being injected, but I think using the User string in .net shouldn't be done for this reason, however I'm also wondering about the System.Security.Principal.WindowsPrincipal namespace being an ldap injection vulnerability itself.

Are there anyways to prevent this besides whitelist validation, but still allow for using System namespace to exist in a .cs file. Or should the User classes intended to be custom, be changed to another string?

I can infer from your question that you are using a SPNEGO LDAP Web Server Delegation Authentication scenario.

This means you shouldn't be allowing anonymous authentication in IIS, since you're delegating into IIS to authenticate the user you have no choice on your app but to accept whatever answer IIS gives you. If you have anonymous authentication it might be possible for a user to claim to be someone that he is not.
Also, usually System.Security.Principal.WindowsPrincipal is used to know what user is running the application and System.Web.HttpContext.User is the right object to identify the user logged in through the web request.

This analysis might be way off, I would need to see application pool configuration, IIS configuration and authentication module implementation details to be sure of what is going on.


MITM during legitimate key/fingerprint change A key/fingerprint change occurred on a friend's server to which I have access. So I text him and ask, "Did you change the certificates?" upon which he answer "Yes".

My initial thought is then to update my local fingerprint, but then it occurred to me: What if someone does a MITM attack simultaneously as my friend has done this legitimate change?

How do I proceed to make sure I'm not being tricked?

PS! In this particular case, my friend went from a self-signed certificate to using Let's Encrypt, but answers should reflect any situation involving a change of fingerprint.

Let's call your friend Bob.

Bob has updated his certificate, but since you've never seen it before, you're rightly concerned Eve may be in the middle. You've done the right thing by contacting him to verify your observation, but there is still no automated way of confirming the new key. I'm presuming you aren't using any signing authority and explicitly trusting the specific certificate on Bob's end?

You already trust him to confirm the key changes over text, so simply sending the fingerprint over another text would do the trick.

Essentially, you need to use some out-of-band method to confirm the new key (e.g. meet him in person), or find a way for him to deliver the key over another, established trusted channel e.g. signed e-mail, signed PGP, Text/WhatsApp, putting it on a website you know only he controls etc.

This is why a Certificate Authority is so useful - it's the root of your trust in the remote system. If you trust Let's Encrypt (which you should by default, as it's certificate is issued by another trusted root CA in most browsers/OSes) then this problem goes away.


What measures exist to protect against an attacker "forcing employees to comply" Do any measures exist to protect against the kind of attack depicted in this XKCD, and does this kind of attack have a name?

Basically I'm referring to a criminal threatening violence against a person if they do not give them the key.

I had worked at a company that (IMHO) had many nonsense security policies (especially when it came to physicals locks) and wondered: we lock things up but often leave the keys close to where the lock is. For example we would lock the laptop to the desk and shut the desk drawer if we left our desk, but would leave the keys in an unlocked drawer or personal belongings at the desk. Would it really be safer to carry keys and security badges on your person?

The only concept of a counter measure I've seen is how TrueCrypt has hidden volumes.

Some common terms for this is "rubber hose cryptography" or sometimes "monkey wrench cryptography". I have also heard it being refered to as "the one side channel to rule them all", but that is hardly an established name.

What this boils down to is the realisation that in the end all security relies on physical security. If the place where you store the key is not secure, the data protected by the key is not secure. If the place where you store your key is your memory (or your back pocket), what we are talking about here is your physical security.

There is no silver bullet for this one. A clever trick like hidden volumes is not useless, but I can imagine that a violent, determined, and competent attacker would make you talk about them.

You can split the key or store the parts on different locations. Or you can leverage an existing institution by putting the key in a safe deposit (that requires you to show ID) at a bank. Both of these are very unpractical if you need the key for daily use, and both can of course be broken. In fact, the last one might even just escalate the situation when the attacker is forced to take more drastic actions to compulse you to get the key from the bank.

Others solutions include setting up a dead man's switch (where the data is automatically deleted unless you check in each day) or having a fake key that when used deletes the data. These could prevent the attacker from getting to the data, but obviously at the cost of the data being deleted.

And would you really like to deal with the guy with the monkey wrench after he finds out you duped him? If you are worried about a violent attacker, you need to have a hard think about wheater the integrity of your data is really more important to you than your knee caps or your life. In a lot of cases, the best solution is to give up and give the guy with the monkey wrench what he wants. After that, you can call the police. Unless the attacker is the police, of course...

So why doesn't the bad guys always attack with a rubber hose instead of with Metasploit? Using violence is expensive:

The victim will know that you attacked, and stole the data.
You need physical proximity to the victim, and the attack can not be automated.
A lot of people think you can still go to heaven even if you abuse SQLi vulnerabilities, but waterboarding will land you in hell.
It is risky. What if the victim fights back? What if you get caught? I have never heard of anyone getting shot while doing packet injection.
The police is way more likely to try to track you down if you commit violent crimes. And they are way more likely to succeed - covering your traces in the real world is hard. You can not hide behind a proxy server in Nigeria.

So unless your day job is being James Bond, perhaps you should not worry to much.


InfoSec Jobs without College Degree With Work Experience? This question as been asked before it seems, but I could use some advice myself for my specific situation. I am very frustrated with my university. I study software engineering and I am very bored. I finished my first year of college awhile back and I didn't learn much mostly calculus and chemistry. The main advantage is the cyber defense competitions which we do and I was able to win that last spring and got an internship at a company for the next academic year part time (20 hours a week) doing InfoSec work (security monitoring and internal penetration testing is what I am told).

I am frustrated by the university now I have to study Diffeq and physics this summer and I would much rather be reverse engineering, working on a blog to showcase my skills, and getting certifications. People who don't work in InfoSec have told me I need a college degree, but when I meet people who are seniors and have been through all these courses and can barely explain how what SQL injection is let alone how to exploit it I begin to question that logic.

I have been studying InfoSec since I was in middle school and while I am no expert I do know a thing or two. I am great at teaching myself. I have another company I am trying to get an internship at who had challenges online and I completed all of them and sent them my resume.

Unfortunately, they had already hired interns because I did not find the challenges until very late, but said I could contact them in the fall. I feel like I have all the skills to get into the InfoSec field, but lack the college degree. If I did my internship next academic year and instead of going to university I got the OSCP, OSCE, and OSWP certifications could I just leave college and go work in the InfoSec field? Could I get a full time job as an entry level penetration tester. I don't really care if it is a junior position I just want to turn my hobby into a career and going to college does not seem to be getting me where I want to be. Getting a job in the field I would be able to work in security full time while being able to spend all my free time (I love what I do) continuing to improve my skills I don't think I would have any problems at all and would not have to spend three more years or four more years for the masters program of my life at university.

I know this question has been asked before, but I could use some solid advice.I really very much would love to work in the InfoSec field and not have to spend any more time at college bored, but I will do it if that is what it takes.I have seen a number of blog posts by people who say you don't need a college degree for InfoSec. This is really a gamble and if I am going to take it then I could use some guidance.

TL; DR if I left college and got some certifications to prove my skills would I be able to get a job. I have an internship for the next academic year which is part time doing internal penetration testing and security monitoring. But, if instead of going to college I spent that time getting the OSCP, OSCE, and OSWP certifications with that work experience could I get a job as an entry level penetration tester without a college degree. I am bored in college and want to be challenged and not have to work around college bureaucracy to have time to study InfoSec.

Yes and No, Yes you can leave college and get a job as a pen tester and work in infosec doing that. I will tell you though as someone without a college degree that works in infosec that not having college degree does hold you back in some parts of the field.

There are a ton of HR departments that hold very dear to the idea that anybody without a college degree is not worth considering. It will be an uphill battle of proving your worth for every job that you get. If I was to be starting over right now I would have stayed in school and gotten my degree.

You are on the right path though. Start now getting your name and experience built up and when you get out of college you will have a leg up on everyone else.


Report an email address being used by a phisher A close friend fell for a phishing scam earlier today. His account's all squared up now, but I decided to do a bit of investigation.

The website he fell for was a very poor imitation of a Remax site hosted on what appears to be a compromised domain. The email address that the captured passwords were being sent to is plainly obvious in the site's script. It's a GMail address, and given the recency of attacks I'd say it is still actively being used to harvest logins.

So, armed with that information, I would like to have the account taken down to prevent the (probable script kiddie) from inflicting any more damage. What's the best way to report a suspected phisher's email address?

I am aware that the email address may (a) belong to a legitimate user who is unaware that it is being used nefariously, or (b) be a very temporary account that is simply used to collect addresses. So I am not about to do anything stupid to the account itself, nor am I going to attempt to contact it. I am simply wondering if anyone has any advice, or if I should just forget about it (though I do wish to prevent this unfortunate thing from happening to others).

Since it's so easy to anonymously register an email address, I doubt it belongs to a legitimate user. Legitimate servers/websites are often hijacked for use in phising/malware distribution/C&C since it can make attacks look more legitimate, and because it's easier than to anonymously pay for and run it. This doesn't really apply to emails.

I absolutely think you should report it.

Since it's Google, you can report it here:

https://support.google.com/mail/contact/abuse?hl=en&rd=2
http://support.google.com/bin/static.py?hl=en&ts=1114905&page=ts.cs

I wouldn't expect a response though. As is often the case with reports like this; they may go ignored. I've not personally dealt with Google regarding problems like this so maybe they handle it well.


Can I encrypt the packets that are sent to my router? Is there a way to encrypt HTTP traffic to avoid man-in-the-middle attacks?

I use Google Chrome.

Is there a way to encrypt traffic to avoid MITM attacks?

Many! Almost every good method for this involves a public/private keypair. To ensure that you are corrected to the correct endpoint, you must know trust the other side's key. If you don't somehow verify the key on the other end of the connection, the value is very limited as an attack can substitute themselves during the connection setup.

As long as your endpoint is verified, you can make a safe connection from open WiFi at DEFCON and have a safe connection (so far as we know, but the researchers do like to play there). SSL, SSH, IPSEC... they all follow these rules.

Since you mentioned a secure connection to your router, there are two things to look at. The first is that if you're trying to protect against people who aren't authorized to connect to your network and you're wireless, WPA2 with a strong passphrase will keep you from associating with the wrong access point or them associating with your access point... as long as you have WiFi protected setup turned off, anyway.

The second thing is back to the "uniform" setup that should work even with mischief on your own network: a VPN. Enable an appropriate VPN (IPSEC or other; there are a few) on your router and connect to that when you come online.


AV inserting email header logic I want to write a small PHP emailing class to be able to send HTML emails. My problem is that in the receiving email an antivirus will insert a header which sometimes simply breaks the entire email.

Unfortunately I cannot find the logic after which this AV is guided because the header is broken under quite a few conditions, either after the 'MIME-Version: 1.0' or after 'Content...' or after the 'From' header.

Can anyone give some pointers on the rules these AV insert these headers?

How is it breaking the e-mail?  Is your e-mail format that you are generating correct?  It sounds like most likely something about the formatting of your e-mail is off but it is still able to be parsed until the AV does its thing.  I'm not aware of any AV software that actually breaks e-mails in general.  Perhaps I don't understand what you mean by broken though.


Sites that allow user-generated content Is there a way to identify which popular sites will host arbitrary user-generated content?

I am doing some analysis to detect phishing sites.  It would be nice to use the popularity of a website as a way to weed out sites that, most likely, aren't phishing sites.  For instance, Google.com and Amazon.com are very unlikely to be hosting a phishing site.  Thus, very popular sites might be considered trusted.  However, popularity isn't a perfect proxy for trust, if some popular sites allow hosting arbitrary user content.  For instance, Wordpress.com, Github.io, Googleusercontent.com, and Wix.com probably shouldn't be considered as trusted, because they host user-generated content and thus could be used to host a phishing attack.

Is there any way to obtain a list of such sites?  I only care about this for the most popular sites (e.g., the Alexa top 1000 or so).  Are there any website reputation or trust rating services that provide this information?

At the most basic level: no. Any site can choose to host any content, and have differing levels of sanitation of user generated content, and various levels of security. Even Google has services that could be used for phishing, no matter how challenging it may be to actually do so. Even if a site does not allow it, there are attacks, like DNS poisoning, SQL injection, escalation attacks, and so on, that might leave a normally secure site in a malicious state. Even NASA's own website was once hacked, and could have done a lot of damage if the attackers had intended to do so.


Limit OpenVPN client certificate to specific VPN with shared CA chain I've created a private x509 pki structure with openssl that consists of a self signed Root CA, an Intermediate CA and two Signing CA's. The signing CA's are used to separate the signing of certificates for OpenVPN servers and clients as suggested at the bottom of the Security notes section of the OpenVPN HOWTO.

  Sign server certificates with one CA and client certificates with a different CA. The client configuration ca directive should reference the server-signing CA file, while the server configuration ca directive should reference the client-signing CA file.

This is all configured and working correctly working correctly. However, I have two separate OpenVPN servers for which I'd like to have separation of access. At the moment a client certificate I've issued for one server will work to access the other server as they're both validated through the same CA certification chain.

How do I separate the usage of the client certificates without creating a separate signing CA for each VPN server?

Using hooks

On each server, configure a client-connect hook:

client-connect /etc/openvpn/hooks/client-connect

In the client-connect script, check if the user common name is in a list of common named dedicated for this server instance:

 #!/usr/bin/python3

from sys import exit
from os improt environ

# Load the list of allowed common-names from file.
# One common name per line.
with open("/etc/openvpn/allowed", "rt") as f:
  allowed = f.read().split("\n")

# Allow if the common name is in the list:
if environ["common_name"] in allowed:
  exit(0)
else:
  exit(1)

You can devise any other scheme for deciding if a user is allowed on a given server (naming convntion, looking it up in a postgres database looking if up in a LDAP, etc.)

Using CCD

Alternatively, this list can be defined without hook through with client-config-dir:

ccd-exclusive
client-config-dir  /etc/openvpn/ccd

You should only need to touch a file for each allowed common name:

# Add a user to this service:
touch /etc/openvpn/ccd/john.doe


Can a website that is behind a well configured WAF still be vulnerable to Injection attacks? Say that a web application is behind a well configured WAF, is there still a window of HTTP injection related attacks like SQLi, XSS, LFI, HTMLi?

If so is a WAF considered a redundant defence measure?

Absolutely, there are not perfect protections so there are new ways to do injection appearing from time to time and often there will be a windows of opportunity between when that new type of attacks is published and when it gets fixed or patched.

Many WAF's can do positive security which is a very strong protection against yet unknown attacks in many cases, that would require more configuration and maintenance but it can be very good for security.


Would a CD drive on a driverless car pose a security risk? Hackers are smart. Could they hack a self-driving car through its CD drive? From what I understand, malicious code could be uploaded to the driverless car via CD which could give them access to brakes, windscreen wipers, sensors, etc. (all of which could be used to potentially commit murder or hold the car ransom).

Not on a well-designed car

The CD player is part of the media system. It's likely that the media system has a number of security vulnerabilities, and a malicious CD can probably take control of the media system. It would be difficult to fix this without either greatly increasing the cost, or restricting the functionality of this.

The car control systems - the CAN bus - should be strongly separated from the media systems. In previous attacks, like Jeep hacking, attackers have been able to break across from the media system to the CAN bus. However, this represents poor design and implementation. The two systems should be kept separate - or at least, have a highly restricted interface - and it is possible to do that at reasonable cost.

Whether any future driverless cars will be well designed remains to be seen.


How exactly does Windows Defender in Windows 10 determine when to upload your local files to Microsoft? Every time I install Windows 10, I painstakingly go through every setting that can be found in any GUI setting for the OS, disabling everything that sounds creepy.

One of the most disturbing things I've found is what I believe is called "automatic sample submission", which means that the built-in anti-virus tool in Windows 10 can, by default, decide to upload any file it deems "potentially risky" to Microsoft, "for further analysis". It also mentions that it doesn't do this for files which "may contain personal data".

But how can it know that? Does it:

Simply look at the file extension and only upload .EXE and other "obvious binaries"?
Does it ignore the file extension and instead look inside the file to check if it contains executable code?
A combination of both?

What happens if I have a word processing document full of private information, but which also has a malicious macro or something accidentally baked (embedded) into it?

What happens if I have an EXE which actually has had all data files baked into it while I'm developing a game as to be a single file? (This is an actual situation I've been in in the past.)

Does it deem the data files for my local PostgreSQL database full of ultra-private information as "potentially dangerous" and upload those?

I can think of numerous situations where even the smartest code in the world would not be able to determine what contains private data or not. And, frankly, I have virtually zero confidence left in Microsoft's judgment at this point, having wasted a huge amount of my life fighting the OS to be able to use it at all. I've found numerous typos in their "stable" releases, making me extremely scared of how much data has been uploaded in spite of all the care I've tried to take to avoid it.

I also remember that it eagerly wanted to re-enable this feature, even harassing me about it. I can imagine that the vast majority of users have no idea about this, let alone have gone through the trouble of force-disabling it.

This is actually a simple and clear policy by Microsoft (but it may have deeper issues):

Even if you choose to accept the Automatic Sample Submission feature remaining enabled, if the file Microsoft is requesting is a data file of any sort, then there should be a prompt to confirm. The only files that Microsoft will send without confirmation are executable files, which for most consumer users are not personally created items.

Now there's another dirty trick to all this:

A document is not an executable, but it may contain executable code. Therefore, MS may consider it an executable and auto-submit it, but they officially state in the case of a Word document or Excel spreadsheet that seems to contain a potentially dangerous macros—you’ll be prompted before it’s sent to Microsoft. The problem here: how they interpret a file with personal information. Some less known programs may use various not widely known extensions which may not be treated as a document holding personal information.

This behavior also may vary depending on updates/versions so the only way to be 100% certain of how it acts is by practically testing.

Also, one should be careful with the Cloud-based protection feature. Specially crafted files may end-up actually doing damage to non-malicious files. Even if such a thing did not yet happen on large scale, one must not exclude for such a possibility.

Harassing is indeed over-exaggerated in Windows 10: it happens in many cases when it comes to 'features' or updates. Example: after it kept stressing me about a reboot required for updating, I bypasses the system and scheduled the reboot for 2099. After that, a desktop notification stared to appear to remind me to reboot before schedule.
So this system of spam-like notifications practically acts more annoying than an actual fake anti-virus.


VPN and Domain Purchase from Compromised RDP My coworker's computer was logged into via RDP by an unknown person. He took pictures of what was open on the desktop before being disconnected when the other person logged back in.

The hacker was in the process of purchasing a VPN and a domain with a (probably stolen?) credit card.

Why were they purchasing these things via RDP? So it can't easily be traced back to them? Or were they going to connect the computer via VPN to a botnet or something?

Yes, RDP over VPNs is the current method of choice for carders. Increasingly so due to many proxy configurations becoming much less effective than they used to be thanks to improved anti-fraud purchasing mechanisms.

They need a Windows machine on a clean IP to build a legitimate browser fingerprint and successfully fool a website's payment system into believing they're not a fraud.


Fuzzing: Quickly find the exact number of bytes I'm currently practicing buffer overflow. And I have a question for you regarding fuzzing.

I am able to develop a python script that will try several buffer sizes to crash an application. It works well, and returns the buffer size to which the application crashed.

However the value I get from my script is not necessarily the size that "allows EIP rewriting". To find this buffer size I usually have to grope...

The problem is, when I look for the exact number of byte, I am forced to :

Start my debugger (edb-debugger) on kali.
Launch the application
Launch my script with +1 or -1 at the buffer size
Check if EIP is overwritten

If this is not the case, I start over and over again...

It's an operation that wastes too much time. Can we make this step faster? With an extra setting in the debugger that will automatically restart the application as long as EIP is not overwritten? Or with a specific setting in a script?

In my case the application (crossfire) crashes at 4377 bytes first. but EIP is not overwritten.

4378 bytes, it's the same thing.

And 4379 bytes, it's Good !! EIP is Overwritten !

But when i try 4380 (or higher), EIP isn't overwritten... and i don't understand why.

Maybe I am misunderstanding but usually overwriting too much is not a problem.

The common approach therefore is to overwrite more than necessary but using a specific pattern. Looking at what ends up in EIP and searching for it in the pattern will tell you the exact position of the data that ends up in EIP.

Exploitation tools usually have this for, example PEDA has the pattern functionality.