How does a Certificate get associated to the private key pair? I am new to SSL certs and trying to understanding once the certificate is imported into the Certificate Store (in Windows), how do we associate the private key pair to the certificate? Is that by creating a pfx that would contain the certificate and private key and import that pfx into Certificate Store? We intent to use the TPM to store the private key (but not using it to generate the keypair).  Is there a way to specify where the private key is to be stored (ie into the TPM)?

Is there a way to specify where the private key is to be stored (ie into the TPM)?

Not from GUI. You have to use command-line tool certutil:
certutil -csp "Microsoft Platform Crypto Provider" -importpfx path\ssl.pfx


How do I store Diffie-Hellman parameters in a X.509 certificate? In their paper Authentication and authenticated key exchange, Diffie, van Oorschot and Wiener recommend to insert the DH parameters into the certificate of Alice. As a result, an attacker can not change the DH parameters unnoticed.

Now my question is: How do I store the DH parameters in a X.509 certificate?
Should I just add them as an extension?

The usual way this is done is to have Alice sign the set of DH parameters to use. This requires Alice's key and certificate to be appropriate for signatures. In two widely deployed protocols:

In SSL/TLS, when Alice (the server) wants to use Diffie-Hellman for key exchange, it selects one of the DHE cipher suites. The DH parameters and the DH public key (the server's half of the DH) are encoded as a ServerKeyExchange message, which the server signs with its private key.
In S/MIME, when Alice signs an email, she can include in the signature object (under the cover of the signature) an SMIMECapabilities attribute which can contain the DH parameters and public key to use, should the recipient wish the respond to Alice with an encrypted email.

It is also possible to have a certificate which contains a DH public key (and parameters) directly, but this is much more rarely done because such certificates cannot be used for signatures, only key exchange.

The DH parameters themselves (not the public key) could also be "well-known" and thus distributed with the software. This is what usually happens with elliptic-curve variants of DH (building your own curve is possible but relatively expensive, and most software only supports a subset of the 15 NIST curves).

Custom extensions means that only your software will be able to process them, which is often restrictive, so this is discouraged. Also, embedding data in the certificate implies that the data (whatever it is) is chosen by the CA and has the same lifetime than the certificate itself, which may or may not be adequate (this is worth considering).


Is XSS dangerous in application without database? I think it definitelly isn't, because XSS which isn't saved anywhere would damage ONLY attacker.

Am I right or are there any cases where XSS could hurt non-db-application? (I mean datas are not saved anywhere)

Very wrong, the basic form of XSS is Reflected XSS, where the payload is sent in the URL (for example) from the victim himself.
This is most commonly used in phishing attacks, where the attacker crafts the malicious link, and mails it in social engineering attacks to his victims, or posts it on public forums, etc.
In general XSS has nothing to do with database (unless it's Persistent / Stored XSS).

See XSS on OWASP for more details.


Intercepting TCP traffic through MITM attack I'm trying to capture TCP requests through Burp Suite with this hacky method.

Basically it listens for user selected protocol requests (TCP/UDP) and then forwards them to Burp Suite (or any other tool, if you want to) just like they're HTTP requests. All this by setting a proxy, and Burp Suite will listen to that proxy IP/Port.

However, what I need to do is listening to a website which sends TCP packets, so I should see HTTP/HTTPS requests too. This is what I tried:

sudo python mitm_relay.py -l 0.0.0.0 -p 127.0.0.1:8081 -r tcp:80:example.com:80

where 0.0.0.0 listens to any local interface, proxy listener has been set to 127.0.0.1:8081 and example.com hostname will be converted to his IP address I will send TCP packets to (port set to 80).
However, I've set my default Firefox proxy to 127.0.0.1:8081 and when I navigate to example.com I can't see any packet being sniffed under my terminal.

Also this is not an HTTP request, so I've generated my server.pem and server.key just exactly it's been described here:

~/mitm_relay/ $ ls | grep -iE 'ca|ser'
cacert.cer
cacert.pem
cacert.srl
cakey.cer
cakey.pem
server.csr
server.key
server.pem

(those are all generated files through those commands).

How can I intercept TCP requests to example.com on port 80?
How can I intercept any domain TCP request on port 80?
What's an example command of intercepting SSL data (like HTTPS) through that script with those generated certificate files?
Is setting Burp to listen to 127.0.0.1:8081 proxy enough for applying the 3 precedent questions?

I've set my default Firefox proxy to 127.0.0.1:8081

You shouldn't do that, the -p argument is there to specify where the Burp proxy is running.

  when I navigate to example.com

It doesn't matter where in particular you navigate (though google.com probably wouldn't work because of strict transport security). All requests targeting the port 80/tcp would be intercepted with the script and routed to example.com through Burp proxy.

Note that you may be running something on your port 80 already. I suggest changing the port number, e.g. to tcp:81:example.com:80, and try navigating to 127.0.0.1:81 to see if it works this way. If the port 81 works and port 80 doesn't, try using ss or netstat to figure out which program is taking over the port 80.

  Also this is not an HTTPS request, so I've generated
  my server.pem and server.key

You don't need them for HTTP requests.

  How can I intercept any domain TCP request on port 80?

I don't think this tool is generally well suitable for this task.

You can do it only by setting up a real proxy (like Squid) somewhere on your machine. The -l argument controls what resource do you intercept. The -r argument only controls:

The port
Where do you forward traffic.

In order for your requests to be handled by the target domain you need a proxy under the -r argument.

  What's an example command of intercepting SSL data (like HTTPS) through that script with those generated certificate files?

sudo python mitm_relay.py -l 0.0.0.0 -p 127.0.0.1:8081 -r tcp:443:example.com:443 -c server.pem -k server.key

Note that your browser would display a warning that the connection is untrusted, and google.com inevitably wouldn't work in Chrome. Firefox would be okay as of 12 April, 2020 — though this particular part of the answer probably won't age well.


Mail server (sendmail) sends spam to innocent people I asked this same question in serverfault but realized that wasn't the right place, I apologize.

Background

Server OS: Ubuntu 10.04

Mailing Application: Sendmail

Recently I asked about backscatter on a mail server running sendmail, Amazon noticed me that my server is sending junk mails to others in the form of backscatter. I later removed the sendmail's ability to receive incoming emails by stopping the daemon from listening on port 25. The message queue is still setup to run periodically. So after that my server can only send emails to outside, preventing backscatter.

Bad News

After a few days I got an abuse report from Amazon, saying the exact same thing (sending spam). I immediately check the mail log on my server and found that my daemon sent out 3 emails to 2 unfortunate users at gmail.

What Next?

Since I'm certain that my server can not receive any incoming emails, I believe there is some malicious scripts sitting on my server doing nasty things. Thus what are the steps that I can take to diagnose for any of these evil scripts? What logs can I check for more records, and how can I locate the scripts who sent these emails?

This sounds like you have Open SMTP relays that need to be configured. The SMTP relay machine should only accept mail for relay to domains you host. For example, if you host the domain maildomain.com, the SMTP relay should only accept mail for that domain and reject mail for any other domain. (At least, this should be the case for unauthenticated connections). The reason for this is that if external SMTP servers and clients can send mail to other domains through your SMTP relay, then those machines will be able to relay spam through your SMTP server. You want to reject mail sent to the SMTP relay for domains you do not host.

This is a critical configuration. I’ve talked to a lot of ISA Server  and Exchange administrator’s who have been put on dreaded RBLs because they did not correctly configure their SMTP relays to prevent unauthenticated relay. If you’ve been victimized by one or more of these RBLs, you know that you might as well try to come out a winner in an IRS audit. For this reason I highly recommend that you do not publish SMTP relays to the Internet until you have a good understanding on how to configure the relay to prevent spammers from abusing it.

The IIS SMTP service allows you to create remote domains and then configure those remote domains to relay mail to a server on your internal network. The SMTP relay is configured with remote domains for the domains you host and relay mail to your Exchange Server or to another SMTP relay on your internal network. The default IIS and Exchange SMTP server configuration blocks mail relay while allowing relay for mail addressed to the remote domains you configure.


Is this much distrust really necessary? In IT Security and computer power users there seems to be an excessive amount of distrust. They don't do anything or use anything because of this distrust, or use what seems like an excessive amount of protection.

Note: I am writing this from the point of view of a person living in the US. The following assumptions obviously wouldn't make sense in some oppressive governments

Distrust of X because of MITM or general interception - Exactly how often does a MITM happen? It seems that every time I hear "Encryption, Encryption, Encryption!" its coming from a person who expects that there's a MITM attack happening everywhere; at this very moment there's a person sitting outside of their house with a wire hooked up somewhere eagerly looking at Wireshark. Lets be serious, this doesn't happen often (eg 90% of the population)
Distrust of Service X or Program Y because you haven't verified its source - I've seen this before with everything from http://lastpass.com and http://random.org to http://gmail.com. This I think is crazy because you looking at the code does NOT guarantee that its clean. All it takes is one innocent looking line to do damage. And your supposed to find this line in 5,000, 10,000, 20,000 lines of code? Be serious, your most likely not going to find it and therefor going to be using it with a false sense of security which is arguably worse than using it with a bit of distrust.
Distrust of public, shared, or friends network because of risk of snooping - This I have to argue with because most people don't have a packet logger or other ways of interception traffic. I'm sure 99% of networks out there just don't care about these kinds of things; they're more worried about routing and firewalling.
Distrust of protocol X because it sends password in the clear - This is what really made me ask this question: People kept blaming FTP sending passwords in the clear as to how the account got compromised. While in that situation it made sense, it seems this excuse is thrown out every time there's a compromise when something else is really the issue (eg password is on a sticky note on the monitor). This goes back to earlier, rarely (if at all) is there a packet sniffer or other forms of snooping on your network, your isp's network, your isp's isp's network, etc.
Distrust of anything because "How do you know its not compromised?" - How do you know there isn't a Nuclear Bomb under your house? What, going to dig up everything just to be sure? How do you know you won't get mugged on the way to work? Going to have a personal bodyguard? Also, how many times does this happen? Is there a nuclear bomb found under someone's house every day? Do you get mugged when crossing the street? Essentially I'm saying that while you don't know, you don't know a lot already and even thin, the risk of it happening is slim.

Is distrust of everything in these cases and others really necessary? Is the level of paranoia warranted? And why would people act this way?

Paranoia, professional skepticism, risk management... sometimes these concept are hard to separate. The odds that somebody is reading my packets right at this moment are relatively low. The odds that somebody has sniffed my internet traffic at some point in the past year... I guarantee it has happened, I've been to DEFCON.

The advent of wireless networking has made MITM attacks more common. Wired networks are not safe and MAC spoofing simple. While it's not highly likely in your home, it is when you're out in the world. Coffee shops, airplanes ("Thanks for paying for 24 hours of access, I borrowed your MAC so I can use it and oh-that's-your-Facebook-account?"), hotel rooms...

Perhaps you stay at home... but you may find that your router has a buffer overflow and is now running malware that sniffs for passwords. There's a court case here in town about a small construction company that lost hundreds of thousands of dollars to wire transfers initiated as a result of packet sniffing.

Even if using telnet for root login is safe 99% of the time, that 1% can have a very high cost, and that's what we're protecting against. There have been some fantastic hacks and MITM work on international scales (DigiNotar hacks, GMail / China, YouTube routed through Pakistan), but there have been many small-scale local ones as well.

That risk is weighed against your needs -- some people really do have to be concerned about the internal design of CPU chips. People are bad at measuring uncommon risk. Ask somebody who doesn't ride how safe motorcycles are, then ask a rider. Ask them both what percentage of motorcycle crashes result in serious injury. I bet you'll get some really different numbers. Consider also the relative cost of safety features in an automobile as compared to the cost for its primary function of moving you around, both in monetary cost and added weight. Firewalls (the literal "stops fire from moving kind), roll cages, seatbelts, airbags that cost $1,000 when deploying in a fender-bender... very few cars are in rollover accidents or burst into flames; do we really need to be that paranoid?

I've seen Google hacked, MITM attacks over cable modems, unauthorized malware performing packet captures, bank accounts cleared out over passwords sniffed, and attempts to put malware into the Linux kernel (automatic root access would have been amazing if that had sat for a year). I've seen random number generation be predictably bad (PHP, Netscape, Debian OpenSSL package) such that the resulting cryptographic authentication or decryption can be performed remotely in little time. I've seen newspapers and governments compromise cell phones of officials in important positions.

On a small scale, you're probably OK. On a big-company-wide scale, you're going to face these risks and you will see your peers lose to them. Paranoia and the security industry are bred because real financial loss happens when people make mistakes that affect big systems.


How should I mitigate the XSS vulnerabilities in KnockoutJS described at mustache-security? The site Mustache-Security describes XSS vulnerabilities in KnockoutJS... The vulnerabilities come from the use of eval (or some equivalent) to convert text in the data-bind attribute to executable script.  Most of the examples show attacks where malicious script could be executed if it is injected into a data-bind attribute.

Example (HTML/JavaScript/KnockoutJS):

...
<select data-bind="options: alert(99)"></select>

While I can reproduce the examples as they are defined, I normally avoid putting JavaScript in data-bind attributes when using KnockoutJS.  I prefer to reference an observable property on a JavaScript object to separate the view's behavior from its layout.  Using this approach, I find that the JavaScript is not executable.

Example (HTML/JavaScript/KnockoutJS):

Is my application at risk of XSS solely because I have used KnockoutJS, or do I also have to find a way to put untrusted input into a data-bind attribute, using server side code?

Example (ASP.NET/HTML/JavaScript/KnockoutJS):

<div data-bind="value: <%=Request.QueryString("id")%>">

I would think that if an attacker could inject their script in the page using JavaScript, then they can just as easily manipulate the DOM directly and KnockoutJS doesn't increase my risk of XSS.

Is there something else I'm missing?  What else must I do to prevent the XSS vulnerabilities that the author describes?

The attack described in mustache-security describes a bypass of a Web Application Firewall (WAF) that try to prevent XSS by dropping HTTP requests that contain


John The Ripper Unknown ciphertext format name requested I wanted to crack my windows xp passwords contained in the SAM file with john the ripper, this file contains hashed passwords with NTLM algorithm, but when i use this command to specify the hashing algorithm john --format=netntlm password.txt, i get the following error Unknown ciphertext format name requested.

And when i try to crack the password file without the format option, then john the ripper uses the LM algorithm, so this way it will never find the password.

How can i add some new hashing algorithms to john the ripper ??!!

PS : I am using ubuntu 15.10 (with Linux kernel > 4), and i installed john the ripper from Ubuntu repositories.

Use the "Jumbo" Community supported version of JtR. This has extra hash types and various other optimisations, but may need to be compiled for specific operating systems, such as Ubuntu Linux.

There are some instructions on compiling it at the JtR wiki


Why are DDos-Attacks still possible? There are so many Intrusion Detection Systems and systems that block IP Addresses with suspicous behavior. Everyone can use those systems, as many of them are free.

But why is it then still possible for people like anonymous to DDos a Server, if they should be blocked immediately by the system?

Are the DDos Programs used special programs?

Blocking attack traffic at the firewall will mitigate an attack designed to overwhelm server CPU or memory resources, but most high-profile attacks simply send a flood of data aiming to exhaust the target's network bandwidth. In this case the attacker doesn't care if you are blocking the data, because by the time your firewall can block it your network bandwidth has already been consumed.

For an analogy imagine if you owned a shop in a mall and a competitor sends a flood of fake shoppers to crowd your store, intending to prevent real shoppers from being able to enter. You can learn to recognize these fake shoppers and turn them away at the door, but it won't do any good because your store's entrance is still jam packed with fake shoppers. The problem would need to be dealt with upstream where there is more capacity, for instance at the mall's entrance.


This site uses a weak security configuration - SHA-1 signatures One of our users just sent us a screenshot of them browsing our site using Chrome for OS X, version 44.0.2403.130. This came as a surprise because I thought that our certificates were up to date (via RapidSSL). I'm not 100% sure I understand the issue and am trying to figure out what we can do to fix it.

Thank you in advance

EDIT - Updated based on comments from @AdmSelec below and info from GlobalSign

Whilst usually when that error pops up it'll likely relate to SHA-1 hashing, in this case it appears more likely that it relates to a bug in Chromium on OSX (details here).

Whilst the screenshot displayed doesn't show the certificate itself it does show information on the issuing CA indicating that it uses SHA256 and usually a CA will not issue a SHA-1 signed certificate from a SHA-2 signed Intermediate.

General Answer for seeing SHA-1 cert errors

The specific concern here relates to the SHA-1 hashing algorithm that is in use as part of your certificate.  SHA-1 was a commonly used algorithm for this in the past but it is now considered insecure, and modern browsers are starting to deprecate it (causing the warning your user is seeing), more information on the deprecation can be found here or here amongst others.

What you need to do is re-issue your certificate using an updated set of algorithms.  The instructions will vary depending on the company issuing it, but there are some pointers here which appear to include a reference for RapidSSL.

I'd expect if you contact RapidSSL support they should also be able to help.


What happens when a TPM chip breaks or fails? I read that a TPM (Trusted Platform Module) has some sort of burnt in key that it uses, along with the password you provide, to encrypt your data. The point is that you cannot decrypt your Hard Disk without the TPM (please correct me if I'm wrong). The question is: Do you completely loose access to your data if the TPM breaks?

What if it simply fails, like many chips do? Do you lose all your data that you encrypted using said TPM chip?

Imagine the scenario where you spill some water on your laptop, it gets to the TPM, and fries it! TPM chip is now unusable, but, since you do a daily backup of everything, you still have the data (a mirror copy of your HDD), but not the TPM (because it doesn't work anymore). Is the data lost forever?

The purpose of a TPM module is to ensure that there is absolutely no way to obtain the keys stored on it. Whether or not it actually fulfills that purpose is a topic for another question. For now let's assume that it works as designed. That means when the TPM module is destroyed, so is the key, and so is any hope to decrypt the data encrypted with it.

However, most backup solutions do not binary mirror the hard drive they back up. A proper backup solution must provide the ability to fully recover the data even in case the original system is a complete physical loss. So any dependence on any part of the backed up system would be counter-productive. Usually a backup solution backs up the cleartext data. There are also solutions where the backup is encrypted with a key before sending it to a backup system but in that case the key should be backed up elsewhere (this means you need two backup systems: A small-space/high-security one for the key and a large-space/low-security one for the data). The backup system might or might not encrypt the backups independently with its own key on its own hard drives.


Is every plain flow into a dangerous sink exploitable? Given a flow of information (for example from the URL) into a sink on a certain site, and given that this information is plain, i.e. is not sanitized, does this mean that if an attacker could control the information flow, this will ALWAYS give the attacker an exploit? Or does the exploitability rather depend on the situation?
If the latter is true, could you give me an example of a sink, where the provided modified information would not lead to an exploit?

If the sink is in a renderable or executable context (HTTP headers, HTML, CSS, JS, SVG, etc.), then yes, an unsanitized and unrestricted flow is always dangerous. Not all of them will directly lead to script execution - it's not possible to have scripts in (modern) CSS, and they're ignored in SVGs that are rendered inside img tags - but they still allow a malicious third party to control content on your page (which could lead to anything from tricking the user into unsafe actions to simply upsetting them with vulgar content that harms your site's reputation).
Note that some sources may only allow restricted inputs, which will need to be decoded/unescaped to allow full character sets. For example, most parts of a URL can't contain characters such as quotation marks in modern browsers (the browser will automatically URL-encode them before sending to the server), and no part of a URL can contain a newline. However, many server frameworks automatically URL-decode parsed URLs - after all, the developer probably doesn't want to receive URL-encoded characters when doing things like putting them in the DB or executing a search - and in that case there's no limit on what can go in a URL. Other sources may have similar restrictions and bypasses.
Note also that, for attacks either against the server (SQL injection, XML attacks, uploaded file path traversal, etc.) or that use the server to store malicious content for use later against users (stored XSS, malicious file uploads, etc.), the attacker is not limited to what a browser will send. The attacker can instead craft custom requests using tools like curl or even ncat/socat, and those requests will be sent verbatim with no restrictions. In other words, you shouldn't rely on things like "modern browsers automatically escape characters in the URL".


Security logs on Linux, Solaris and Windows As the company's security department, our system administrators ask us what they need to log for SIEM (Security Incident and Event Management). We don't have any prepared documents and are seeking something that combines the combined wisdom of COBIT, PCI, etc. in a way we can present to other departments.

This is a mind-blowingly huge question.  What you need to log is business specific need.  Typically, you want to log administrative logins and changes.  But still that is pretty basic.   What you need is a better understanding from the people who drive you organization on what systems are important.  A good business continuity plan with some risk assessments will drive you far.

I am realistic, and I know that getting that is probably a non-starter.  So can I offer this, if you are trying to tune your SIEM product, don't just slam everything in there at once.  Pick something, like Network Switches and get those sending logs and tuned up before you move onto the next thing, say Domain Controllers.

You want your SIEM to only be notifying you of a problem, if you are inundated with 400 alerts per day, your SIEM tool is almost worthless and you should've just deployed a syslog server and saved a bunch of cash.


What's the added benefit of having a CSRF token for an account activation link? We have a simple webapp where a user will have to create an account. To verify their email address (which will be used to send notifications later for business purposes, which is one of the core features of the application), we send an activation link.

Our activation link leads to a different sub-domain. Because of this, and the ability for the user to open this activation link on a different computer/browser (such as on your PC instead of on your phone), the user would need to get a new CSRF token when following the activation link.

When activating your account, you do not need to be logged in. (You could be logged in, but not to the account that you're activating.)

So when activating their account, the following happens:

the user clicks on the link,
the front-end which handles such requests opens,
the front-end makes a pre-flight request to our server to obtain a CSRF token,
the front-end receives the CSRF token,
the front-end uses the parameters passed in the url to send an activation request to our server.
The server sends back the appropriate response after handling the request
The front-end displays the appropriate page based on the response ("It succeeded, click here to login" or "Your account was already activated, click here to login" or "activation link expired", etc.)

Key point here is that the person who activates an account does not gain any special rights. We don't automatically log the person who activates their account in. People still have to do that themselves.

So then I'm left wondering - why do I need this CSRF token? The activation link contains a activation token, so anyone capable of activating an account either got really lucky or has actually received the email. If an attacker activated an account, all that would happen is "the account is activated".

I'd like to take the CSRF token out of this process to speed up the process (particularily for people with high latency internet). Would I be weakening my security if I took the CSRF token out of the process, so that the process resolves to this:

the user clicks on the link,
the front-end which handles such requests opens,
the front-end uses the parameters passed in the url to send an activation request to our server.
The server sends back the appropriate response after handling the request
The front-end displays the appropriate page based on the response ("It succeeded, click here to login" or "Your account was already activated, click here to login" or "activation link expired", etc.)

TL;DR: Does a CSRF token add security for REST end-points where you don't need to be logged in?

Ok, as I see it, there are two important HTTP requests here:

The first one is generated when the user clicks the activation link. This one is anyway not protected by a CSRF token, but contains an activation token. That all sounds fine.
The frontend will then generate a CSRF token and will send a request to your server to complete the activation. If that request contains the activation code, and the server verifies it, I do not see a reason to have a CSRF token in this particular case, although it's hard to tell for sure without seeing how the requests/responses look like and what they do on the server side. Could it be that the CSRF token is used later for something else? Are there any security related changes on the server or clinet side after performing these requests?

Because the first request is not protected by a CSRF token, and the token is generated on the fly for the second request, this kind of CSRF token implementation does anyway not really make sense for these particular requests because the attacker still has to know only the activation token, if I understood everything right.

What could still go wrong?

An attacker does not know the activation token of the victim so he can't use that attack vector in any case.

But an attacker could create his own account, and make the victim activate it, but this would be only exploitable if that request would have some additional effect, like logging the user in (what is not the case as you described). You must just be very careful that activating the account is the only effect of that request.

Another far fetched scenario would be if the server is always generating the same CSRF tokens for the same activation codes. The attacker could let the server generate CSRF token, but then interrupt the activation of the account (the second request). After that he would make the victim visit the link with his activation could, and he would know what CSRF token the victim got. But that is also a bit far fetched.

In addition to that, using a CSRF token has often some nice side effects, like limiting XSS to self XSS, but that's a more general thing, not specific to your case.

By the way, if you want to speed up things, why do you use the frontend to generate the second request? Why not make the server process the first request and activate the account?

And please do not take what I said for granted because it is hard to give an accurate answer if I did not see the app.


Are newly-generated recovery passwords sent to me via email hashed? If a company sends me a new password via SMS/email because I clicked "forgot my password." Does that mean the company is not actually hashing my passwords?

If they are indeed sending you a new password (i.e.: a system-generated password other than the one you previously had) when you click 'forgot my password' then no, that doesn't mean they're not hashing passwords.  They can have their forgot password function generate a password, hash it and store it in their database, and then (while it's still in memory) generate an email that includes the plaintext value.


tcpdump packets have bad and incorrect checksums on localhost, how to investigate further? Am investigating a macOS Catalina machine that is believed to be infected with malware. Have been viewing packets with tcpdump and noticed, on connecting to any web address, there are legit packet that gets sent to the DNS server... then... there are packets that get sent from 127.0.0.1:53482 (or some port) to 127.0.0.1:443 -- the packet headers are labelled with incorrect checksum (cksum -> incorrect).
Also, there are packets 127.0.0.1:62692 (or some other port) -> 127.0.0.1:32376 labelled bad checksum (bad udp cksum). And, again localhost, 127.0.0.1:5353 -> 224.0.0.251:5353 again with bad checksum (bad udp cksum).
All this traffic is on the lo0 adapter.
Packet traces
Incorrect checksum destination 127.0.0.1:443

Bad checksum destination 127.0.0.1:32376

Bad checksum source 127.0.0.1:5353 destination 224.0.0.251:5353

Attempts to find process:
sudo lsof -i

netstat

My guess is this is related to some corruption with mDNSResponder? Welcoming and appreciate any tips or suggestions on how to solve.

The bad checksums might be the result of checksum offloading: https://wiki.wireshark.org/CaptureSetup/Offloading#Checksum_Offload

Also, you can use the "-p" switch in netstat to show the Process ID, I believe this requires sudo for that switch.

Hope this helps.


Difference between cyber security and information security? What is the difference between an IT security policy, an information security policy and a cyber security policy?

These terms have been used synonymously over the years, but in practice, they are starting to get differentiated.

IT Security policies tend to cover secure policies around the "information technology" itself, the systems that serve and process information. Servers, networks, etc. In some organisations, there would be nothing about end users in these policies and only the IT staff would read them, for instance.

Information Security policies are about the wider security of information, no matter what form that takes. So, that would include paper copies of data in warehouses, as well as databases, cloud services, etc.

Cyber Security policies is the newer term, and tend to cover the information that is served and processed for/by the public and 3rd parties in a digital form. Basically, any data that travels over the Internet. "Internet security" used to be the term used, but that got confused with just user security awareness and how to browse safely, so this other more generic term has gained popularity in use. I am unaware of any formal definition of "cyber", but this is how it is used in practice. Some older information security professionals still roll their eyes at the use of this buzzword in official documents.

But, an organisation can define their terms however they choose to. These policies will include some section explaining what the policy covers, its scope, and where it applies.


What physical, electronic, and software characteristics are important in a smart card? I'm evaluating smart card readers to store a number of private keys, but don't know where to start.

What criteria is important regarding smart cards and preventing the extraction or unauthorized used of the private key?

There is a security standard for smartcards under the Common Criteria scheme: the Smart Card Protection Profile. A protection profile defines the security properties that are expected from a device or system.

The smart card PP is defined for EAL4+. To put it succintly, the EAL defines what aspects of the product's design are evaluated and to what extent (design documents, code review, developer and independent testing, maintenance practice, delivery, etc.). A CC certification also involves penetration testing, and the + in smartcards' EAL4+ is an extra amount of attacker potential in the penetration testing.

You can find a list of certified products on the Common Criteria website as well as on various national websites (certifications up to EAL4 are recognized internationally). Products in that list might be evaluated against a different protection profile that covers a different target: you'll find smartcard components there, and smartcard-based devices such as passports, health cards, cards with a defined software interface such as JavaCard, etc.

Unless you're a government or bank purchaser, you don't have to get a certified product. Certification has a cost, which is reflected in the device's price. Certification isn't a silver bullet: it only says “this looks good”, not “this is absolutely guaranteed to be secure”. In principle, a CC certification gives you independent assurance, because it is conducted by a government-approved third party.

If you consider buying a certified product, be sure to read the fine print. Certifications reports usually come with assumptions that must be met for the certification to be valid; check that these assumptions make sense for you. Also, certification is often a way to shift liability: by having their product certified, the vendor demonstrates that they have used best practices, so you are unlikely to be able to claim damages if their product turns out to be vulnerable.

Even if you don't get a certified product, the protection profile contains useful information: it provides a definition of security objectives, a threat analysis and other elements of security analysis.

Keep in mind that a security infrastructure is only as strong as its weakest component. A super-secure smartcard won't do you any good if it's stolen and the PIN is the user's birth year, or if using the card is so much hassle that people set up ways to bypass it.


Penetration/Vulnerability testing for REST web services Is there any tool to perform penetration/vulnerability testing on REST web services ?

To test REST web service I intercept the traffic from a legitimate client and then fuzz the intercepted requests using BURP's intruder module.  OWAP's ZAP is free and will also do the trick.

When you fuzz any interface you need to have custom data set and you need to understand what can go wrong and how to identify vulnerabilities.  This is not something for a novice to undertake.


How are private keys handled in an enterprise? We would like to start using digital signatures and possibly encryption for e-mails in our company. My knowledge of public-key cryptography is entirely theoretical with no practical experience.

In public-key cryptography, e-mails or documents are signed with the signer's private key. It is crucial that the private key is stored securely, ideally on a piece of hardware like a smart card.

I can see how this was feasible a couple of years ago with employees having just one computer. But how is this handled in present-day enterprises with people using multiple devices (desktop computers, smartphones etc.) to read and write (and sign) e-mails?

Are there solutions available on the market to store the employees' private keys on a device in a secure data center, and whenever someone sends an e-mail the mail server talks to the "private key server" to get the private key and the user then types in their passphrase?

If not, is it common practice to transfer keys to other devices (using a USB connection perhaps), and how would you secure a private key stored on, say, an iPhone that is easily lost or stolen, and probably secured with nothing more than a 4-digit passcode?

Encryption and signatures are two distinct activities, and the difference matters a lot in that respect.

Encryption is about maintaining data confidentiality, except for "authorized users". When these users have private keys, encryption is said to be "end-to-end" in that the decryption will occur on the recipient's device, and can be done only with the help of a private key made accessible to that device by its owner. Corporations, generally speaking, don't like that at all. Encryption prevents them from performing some automatic processing, in particular antivirus scanning (for incoming emails) and detection of information leakage (for outgoing emails). Moreover, encryption raises the issue of data loss: if the private key becomes unavailable, the encrypted emails are no longer readable, since they are typically stored encrypted. Notably, when the user becomes unavailable (he was fired; he retired; he was killed in an accident;...) then the new tenant of his function in the organization must be able to read the corporate emails which were received by that previous user.

Therefore, in a business context, it is often preferred when encryption is centralized -- if there is encryption at all. Emails would often be stored "as is" on servers for which security is done on an "intrusion prevention" basis, rather than mathematically (with cryptography). Encryption is used for data in transit (typically SSL). Users authenticate with the central server when reading or sending emails, but this does not necessarily entails a RSA private key in a smart card. When an email is sent to an external recipient (outside of the organization) then, even if encryption is to be applied, it will be done on a dedicated gateway system, after all due analysis systems have inspected the outgoing email contents and have given the go for further email propagation.

Signatures are avoided. Strictly speaking, a signature is a legal weapon that you build and then point toward yourself. The point of the signature is it is a proof, convincing for third parties, that the email contents are indeed what the signer sent. This can only serve as a way to coerce the signer into accepting extra responsibilities.

If you think properly, then you do not want to sign. You want other people to sign what they send to you. So business try to avoid signatures, and will deploy a system for signing emails only if it is to replace another pre-existing system where there already are signatures done in some other way which is even more inconvenient.

This sums up as the following: if you want to support end-to-end encryption for emails, and/or email signatures, then... think again. Chances are that it is not that good an idea.

Private keys on smart cards, though, are deployed for authentication. Users receive smart cards (possibly with USB token format) containing private keys, and they use that for client SSL connections with a Web server; the client is then their Web browser. This will be for access to sensitive data, so, generally, the corporation will ban such access from "home devices": the employee is not supposed to connect from his own iPad. He shall use only the approved, company-provided laptop computer that is riddled with company-approved antivirus software, and suitably "locked down".

If the daily business calls for some signatures (e.g. medical prescription, in a world of computerized medical file: physicians must be accountable for what they prescribe), then this will not be a basic email, but a strictly formatted "message", signed through a local specific application or some similar trickery (ActiveX control or signed Java applet in a Web site). There again, home devices will not be considered acceptable.

All that being said, some companies have tried, over the years, to sell "virtual smart cards" which usually boil down to some secret value (e.g. a RSA private key) stored with password-based encryption on a server. To a large extent, a GnuPG keyring is an instance of such a system: contains a private key, protected through encryption with a password; put a copy of that keyring on a backup server, and you are all set. "Virtual smart card" commercial solutions mostly aim at making this process easier and more integrated with existing applications (in particular Outlook and Internet Explorer).

To my knowledge, none of such systems was a true commercial success, for the reasons explained above: the added value of these "virtual smart cards" is for situations which you would like, company-wise, to avoid altogether.


How does a VPN help the internet security of a home user? VPN companies tell us you're not safe if you're not using a VPN.

What I'm trying to understand is why, as a home user using the internet at large, a VPN into some VPN hosting company and from there out into the internet is any better (security wise) than going out into the internet from my ISP?

I understand that if I VPN from home into work then it makes sense: the other end of the VPN from me is inside the work secured network, so my traffic is not exposed to the internet.

But for day to day individual use why is it better from a security perspective to come out onto the internet from a VPN hosting company compared to from the ISP?

(I'm aware of, and not really asking about, commercial considerations/benefits such as being able to access content, or affect ads etc)

The assumptions here is that the VPN provider is running from a country that are one or more:

have more freedom than your own, especially if you live in oppressive or very conservative countries, your local internet provider or government may block content/site to materials that they do not want you to have access to (e.g. politically sensitive materials, or things they consider "morally inappropriate"),
doesn't have jurisdiction to physically arrest or harass you. Even if the country have Intel exchange agreement with your residence country, often multi jurisdictional police work are too much a hassle to follow through on smaller infringements,
if your local internet service provider is known to snoop into your internet usage or even sometimes alter content (often ads), and because of monopoly, you can't really switch to a different provider. Legal protection against such snooping may be weak or nonexistent in your country, or they may actually be the one requiring provider to do such snooping.
to bypass geoblocking of copyrighted materials, there are many cases where you can't even legally purchase a movies/show from your home country for any money, so you may prefer to use a VPN that runs from a country where you can access and purchase the material from a trustworthy overseas content provider, instead of from seedy underground services
If your country doesn't have strong net neutrality protection, your local internet provider may have business dealings that aren't in your best interest. For example, they may block or shape traffic from competing content providers or limit resolution because they want you to purchase their overpriced TV service.


Are CVE identifiers assigned for proprietary software packages? If I find a vulnerability while using a proprietary software package can I request a CVE identifier. Or rather vulnerabilities in proprietary software packages are a matter of me reporting issue to vendor and vendor looking into it?

Yes, they are also assigned to proprietary software. An example would be Oracle Database, which has a variety of CVEs assigned to it.

To request an ID, check the CNA coverage table. If the vendor is listed, request from them. Otherwise, request directly from MITRE.

The process of the vendor may or may not include requesting CVEs themselves, so when contacting them let them know that you already requested one or are planning to do so.


I discovered a Client Side Template Injection (CSTI), and after? As part of a bounty bug, I discovered a Client Side Template Injection (CSTI). I would like to create more "impressive" payload to increase the risk of the vulnerability. The framework affected is AngularJS.
Theses payload works:
{{7*7}}
${{constructor.constructor('alert("This is a CSTI");')()}}
${{constructor.constructor('alert(document.cookie);')()}}
${{constructor.constructor('window.prompt("Your session has expired, please enter your password");')()}}

The next steps are to inject a Beef Payload and take screen capture of the list of hooked browser. I precise the affected software is on my computer and I will be my own victim.
I precise the web page affected need to be written with a privileged account but viewed with each user of the web application.
What can I do as more powerful with a CSTI ?

Try to get account takover or user data manipulation. This will be a very dangerous subject.
Good form rules tell us not to be destructive. Just describe vulnerability to security team and list potential harm moments.


Attackers using Minecraft's Java? It has come to my attention that Minecraft no longer requires java to be installed in order to run, meetings its needs from its own local copy of the java. This
was done it order to not force users to install the horrendous piece of malware-magnet that it sadly is.

This means that java is installed, but just not publicly, for the OS to see.
Considering this is a fully-fledged copy of the software, couldn't attackers use it (And its far too plentiful amount of security holes) to gain access to the system? What restraint could possibly block that?

The bad press Java got in the past years which might lead you to the preconception that the whole technology is a "horrendous piece of malware-magnet" applied mostly to the Java browser plugin. This plugin allows to run Java applications embedded in websites (Java Applets). Applets are supposed to be sandboxed so that they can't do any harm, but that sandboxing concept wasn't always as thorough as it should have been. This allowed java applets embedded in malicious websites to do things they were not supposed to do on the visitor's computer, in some cases even install malware.

When you install Minecraft, its Java Runtime Environment doesn't install the Java browser plugin in any web browser you use, so you won't get exposed to drive-by malware in form of malicious Java applets while web browsing.

A JRE being somewhere on a system doesn't provide much attack surface. When an attacker obtained the means to get their malicious Java application onto your computer and invoke the JRE to run it, then they are very likely also able to run any non-Java application they want.


Need advices on API key & secret generation? While working on a Java project using Spring-boot, Spring-security and JWT token, I need to provide access via API key and secret. After searching on Google for a while about key/secret generation, here is what I found:

For key generation, it seems a cryptographically-secured UUID without - would be a good choice.
For secret generation, I didn't find a clear suggestion yet. But it seems some other sites are using the HMAC-SHA512 algorithm for the secret, and store it as base64 string representation (padded out to 88 characters) of the key.

Here are some links describe API key & secret:

https://oauth.com/oauth2-servers/client-registration/client-id-secret/

An example from a bitcoin site, that provides API key/secret access:

https://docs.gdax.com/?javascript#private

The questions are:

What algorithm is suitable for the secret?
Are the sha256 or sha512 algorithms a good choice? If yes, it would be helpful to have some suggestion on its generation.

I think you're confusing the security requirements for client IDs and secrets.

Client ID: Must be unique, better if unguessable. While they are typically not publicly advertised, they are not treated as carefully as secrets are.
Secrets: Must be unguessable and kept private. A potential leak of a secret is a security incident, requiring immediate revocation of the key.

What your client IDs look like is sort of a matter of taste. The examples in the oauth.com site you reference includes keys of varying sizes and formats. A random number is a fine choice. Something like (in pseudocode):

clientID = base64Encode(secureRandom(16)); // 16 bytes, 128 bits, 22 characters

In some situations you could use a non-secure random number, but there are situations where that may lead to predictability. So just stick with the secure random number generator - it's only a little slower and guaranteed to be safe.

The only way to generate a secret is with a secure random number generator:

secret = base64Encode(secureRandom(32)); // 32 bytes, 256 bits, 43 characters

Secrets should never be stored in clear-text. Encrypt them and store the encryption key somewhere secure.

You mentioned GUIDs, but even the random version 4 ones vary by implementation, some being secure and others not. So I'd just stay away from them. You also mentioned SHA256 and SHA512 hash algorithms. It is possible to use those in the calculation of a random number, but it's complex to get that right. Just stick with a secure random number generator and you'll be safe.

As you are already using Spring, RandomValueStringGenerator is probably a good choice for the implementation. Just create generators of the correct number of bytes. You can also look at the source code of that class for reference.


Electronic identity and digital signatures - why they are different? It seems (to me at least) that is is generally accepted that "electronic identity" and "digital signatures" are a different thing. For example, in the Estonian ID card there are two certificates - one for identity, and one for signing.

They correspond to the real-world actions of "showing" your ID card to the authorities, and signing a document, respectively.

However, I don't understand why they have to be different. The same technology with the same infrastructure is/can be used for both. Why can't you use your digital signature for identifying yourself (or your e-identity key-pair to digitally sign a document).

In both cases you use your private key to sign something.

There are implications, of course, e.g. you may think someone is just verifying your identity, but in fact you may be signing a document that you don't want to sign. But one can offer you to sign a harmless document (e.g. "please sign this digital receipt" nonsense), but in fact you may be signing for a loan. People can be tricked via the user interface for digitally signing/identifying either way. (Related question: what are the ways to prevent that from happening?)

Is the distinction needed solely for protecting the owner, or there is a bigger factor for splitting a single technology solution into two?

There are a few reasons for using different keys for signing and authentication:

When using two keys, associated certificates can be issued from different CAs which allows web sites to only ask the user for the authentication certificate on login.
The certificates can be issued with different key usage - the authentication one doesn't need non-repudiation, and the signature one doesn't need access to a ssl client.
Usually the two keys are protected by different PINs with a different PIN policy. The authentication key has simple PIN policy - after an application authenticates with the PIN, the key can be used until the session is closed. On the other hand the signature key usually requires the PIN to be entered before any operation with the key.

I have never used Estonian eID, but on few different eIDs I have tested the keys are issued from different CAs, with different key usage flags and with different PIN policies as described in points 1 to 3.

Edit:
Another reason to use different keys:

A smart card could be configured to refuse key import for a signature slot and to allow it for an authentication slot, or it could support different crypto mechanisms for different slots...


How can I explain to the client that rfc2385 TCP MD5 Checksums can't be turned on for linux webservers? I've had a long running conversation with a client where they perform a Rapid7 security scan which then warns about TCP MD5 checksums missing on port 80. This is what I think I know:

RFC 2385 was designed to protect BGP, and by extension BGP-type protocols (i.e. long running TCP connections).
BGP uses long-running TCP connections, HTTP does not.
Encryption/IPSec has superseded RFC 2385 for protecting BGP.
The TCP RST attack is against long running TCP connections because the attack relies on probability.
The impact against resetting a HTTP kept-alive connection is that the next request would restart it.
Most connections transfer data in milliseconds, the window of attack is too small for HTTP to effectively targeted. The attack depends on the window size and bandwidth of the attacker against the server and seem to take seconds even under good conditions according to page 25 of Slipping in the window: TCP reset attacks)
A web view is typically made up of multiple connections for each connected client making this type of denial of service unattractive compared to alternatives.
Linux (specifically RHEL or Debian) has support for rfc2385 but can't be globally enabled.
Neither NGINX nor Apache has configuration options to open sockets with tcp-md5-checksums enabled.
Even if rfc2385 was active for HTTP, it wouldn't solve a problem, but would increase load on the server. Which is only a minor side point.

I've attempted to explain that rfc2385 isn't relevant to web servers, but they are saying it's an issue with TCP which while true, simplifies that it's an attack against a specific nature of the TCP connection.

I've resorted to explaining that neither Apache and nginx can enable what they're asking for. They keep sending me knowledge base documents mentioning Windows, Cisco, NetBSD, BGP, but never anything relating to apache nor nginx.

Beyond the linked documents I've sent them LWN explaining it:

  It would be hard to use this technique to shut down a web server; HTTP connections tend to be short-lived to begin with.

There is a patch available on Windows that fixes the warning which they are sending through as a suggestion, but it's clearly doesn't accomplish anything for linux.

Am I speaking nonsense? What would be your suggestion of getting the client that have security compliance to worry about to get on the same page as me?

Using MD5 for consistency checking is a clear violation of CWE-327: Use of a Broken or Risky Cryptographic Algorithm.  Any protection that RFC-2387 provided,  is voided by the use of an outdated, and insecure algorithm.

Rapid7 is making the internet less secure with this recommendation.  This BS "vulnerability" is more pointless noise that drowns out real findings.  Rapid7's blind recommendation of RFC-2385 makes HTTP request more difficult to process, thereby making the web server more pone to DDoS attacks.

I would complain to Rapid7, and encourage them to seriously reconsider this  cargo-cult security  recommendation.  Just because its easy to test for,  doesn't mean it is relevant.  Ask Rapid7 to tell your client that this isn't a concern.


How to deal with responsible disclosure "catch and kill" My coworkers and I discovered a significant security issue in a popular cybersecurity tool, which shall go unnamed here for reasons that will become obvious.

We reported the issue to the tool's vendor through their bug bounty program on bugcrowd. They ranked it as a P2 issue and paid us $2,000 for it.

It's now about six months later, and the issue still hasn't been fixed, nor have they given us a timeline for when it will be. They've also informed us that under the terms of their bug bounty program we're not allowed to publicly disclose the issue no matter how long it takes them to fix it. UPDATE: I've followed up with them twice since reporting it, expressing increasing agitation over the fact that the issue still hasn't been fixed and it seems likely to me that it is being exploited, and this is what I've been told each time.

The issue was not arcane or difficult for us to discover and reproduce. There has been plenty of public discussion of issues of this type in tools of this type. This makes me worry that they were aware of the issue before we reported it to them, and paid us the $2,000 bounty to "catch and kill" our report, i.e., to prevent us from disclosing it publicly before they fixed it.

I am concerned that hackers may be leveraging the issue in the wild to compromise people's data, and the the tool's vendor is allowing this to continue by not disclosing or fixing the issue.

Even in the existing version of the tool, there is a workaround that can be applied to minimize the impact of the issue, so disclosure would allow people using the tool to protect themselves even before a fix is released. I am therefore increasingly uncomfortable with sitting on my knowledge about this issue rather than publicly disclosing it.

At this point I'd be happy to send a check for $2,000 back to their corporate mailing address and tell them to take their bounty and shove it and then disclose the issue publicly to protect other users of the tool. The problem with this is that we donated the $2,000 to charity -- as we told them we were planning on doing when we reported the issue to them -- so we don't have the money anymore to send back to them.

Does anybody have any advice to offer?

You should report the vulnerability to Mitre to get a CVE assigned, or on Full Disclosure.

When a vendor refuses to fix a bug that you've reported, it's ethically acceptable to disclose it openly or try to get a CVE assigned for it. This is especially important if you believe that the bug may be being exploited in the wild, and even more so if knowledge of the vulnerability allows easy mitigation by end users. People typically wait a fixed period of time before reporting a vulnerability that has not been fixed. It's common to disclose the issue to the vendor and wait 90 days before making it public.

They will probably kick you out of the program, but they cannot get the money back without engaging in a messy lawsuit. In fact, because such companies are unable to easily take the money back without resorting to legal action, these 0day-selling companies (often the more unethical ones which pay the higher prices) will often give you the payout slowly over a period of time, allowing them to terminate payment early if you disclose the bug without involving the legal system to remedy violations.

It is very important to remember that, while the money is yours (assuming the contract says so!), you could be sued for breach of contract and forced to pay even more money than you earned (both in legal costs and in damages from the lawsuit). While breach of contract is not criminal in most countries, civil law is still in effect. If this is important to you or if you do not want to risk a lawsuit from a litigious company, you should consult a real lawyer and not take legal advice from strangers on the internet.


Is using multiple instances of a browser-PRNG to seed another PRNG more secure? Say I have Math.random() (which supposedly generates ~32 bits of entropy.)
If I use Math.random() + Math.random(), both of them generate ~32 bits of entropy.

I will use the solution of Math.random() + Math.random() to seed another PRNG, so is using Math.random() + Math.random() to seed the PRNG 'better' (as in total entropy input into the system) than using Math.random() by itself?

The Math.random() function in a browser's Javascript engine is not cryptographically secure.

That is, it does not draw from a truly random source of bytes, and it follows a predictable pattern, even if most people would be unable to recognize that pattern.

Simply using one semi-predictable sequences of numbers to set up a different semi-predictable sequence of numbers is not enough to meaningfully increase security.

Rather, if you need security, use window.crypto.getRandomValues() instead.


Prevent a server side script from a direct URL access There is a server side script written in php(say backend_file.php) or coldfusion(say backend_file.cfm).

Lets say, i am using Apache and I have a sample web folder (on my Localhost) like:

backend_file.php
index.php
Is it possible to restrict access of backend_file.php, when directly hit from browser?

However, index.php should be able to access backend_file.php?

Note: index.php is accessible, by direct URL access.

I mentioned index.php should be able to access backend_file.php, as it makes ajax post or get request to fetch information from backend_file.php?

If backend_file.php is going to be accessed via AJAX, then it needs to be requestable by the user.  If it's only going to be accessed via require()/include(), you can use define() and defined() to prevent it from being directly loaded.

In index.php:

define('MAIN_INCLUDED', 1);

In backend_file.php:

if(!defined('MAIN_INCLUDED'))
  exit(1);


jquery.js Dynamic Code Evaluation: Code Injection on setTimeout() line I am working on fixing a potential security issue. I ran my HP fortify SCA and I got a critical priority report on my jquery.js file.

  Category : Dynamic Code Evaluation: Code Injection (3 Issues).

I looked at the source code and it turns out to be the line where the setTimeout() eval code sits.

if (s.async && s.timeout) {
    timeoutTimer = setTimeout( function() {
        jqXHR.abort("timeout");
    }, s.timeout );
}

with a try catch block preceding.

I did a couple of digging and they say do not mess with the third party source code, you may be tampering with other functionalities. I'm thinking just suppress and move on? I usually do not like to suppress critical.

Any ideas?

It's a false positive.

Reporting false code injection vulnerabilities is a well-known problem with HP Fortify and has confused developers before. Fortify just does basic static analysis of the Javascript code and can't go arbitrarily deep to understand how it works. As @AlexanderOMara suggested, it just seems to discover the potentially dangerous setTimeout() function which can, as setInterval(), take a string argument that would be executed as code, just like eval() does. This the sort of vulnerability, the tool aims to discover:

setTimeout('alert(' + document.location.hash.split('#')[1] + ')', 0);

But in your case there is no user-supplied, unfiltered input to the setTimeout() function and it therefore looks safe. Leaving you with a great conclusion from the linked thread:

  My advice is to stop running HP fortify reports.
  Or pay the five thousand, or whatever  dollars to go to their classes so you could actually understand their malarkey.


Wget and Python Requests fail to validate SSL certificates, but browsers don't show any warnings I tried to wget a website, which came back saying:

  ERROR: The certificate of ‘website.com’ is not trusted.
  ERROR: The certificate of ‘website.com’ hasn't got a known issuer.

from one machine, and from another

  ERROR: cannot verify website.com's certificate, issued by ‘CN=GlobalSign Organization Validation CA - SHA256 - G2,O=GlobalSign nv-sa,C=BE’:
    Unable to locally verify the issuer's authority.
  To connect to website.com insecurely, use `--no-check-certificate'.

As an additional check I used Python's request library to see what it would say:

  requests.exceptions.SSLError: ("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",)

However when the website was loaded in Firefox and Chrome, neither had any issue with the website's certificate. Shouldn't they also be warning me about any issues with the sites SSL certificate?

It is not fully clear what your problem exactly is since there are insufficient information to reproduce it. But, assuming that you are using a recent version of wget an requests with support for SNI I would imagine that it is

Either the servers certificate is issued by a CA which is  trusted by the browser but not by your systems CA store. Chrome and Firefox use a different CA stores than wget or requests. This can happen for example if the servers certificate (as received by the client) was issued by a non-public CA, which is often the case when accessing intranet sites or if there is a firewall employed with SSL interception. Especially on Windows systems it might also happen that the certificate store for wget and requests is simply empty since the systems CA store is not compatible with OpenSSL.
Or the site is misconfigured and the server does not send a necessary intermediate certificate. Desktop browsers often work around this problem, other programs don't. Check this site against SSLLabs and look for chain issues.


Information gathering on website I'm pretty new to pentesting and everything about it. This question is primarily for web servers. I'd like to know for you pentesters out there, what information are you looking for when you are analyzing a website for pentesting?

Should I be looking for forms, links, buttons, that do some type of request that passes along some type of data that I can manipulate? How do you find the part of the website to test if it's able to be exploited? When I google something like my question there are all these automated tools that do information gathering process for you, is this the way to go?

This is a very opinion-based question, but I will try my best to answer in a manner that applies as generally as possible.

Anything you may think is valuable
Information Gathering is the first step in pentesting, but it doesn't mean that you only gather information once and then this is all you can work with. You always gather information about the system as you test it.
Sometimes, this is "formal" information, such as the technologies used (ASP.NET, PHP, Node.JS, etc.) or the versions thereof. Sometimes this is much more informal information, such as "These developers really didn't care about security at all".
This informal information is just as valuable, because it can clue you in as to what kinds of vulnerabilities the application may be vulnerable to.
Why do I collect information at all?
Because you need to know what kind of vulnerabilities are possible. If you test a web-application and you see that you can input some data, and it will be printed somewhere later, then you can immediately tell that you should test for Cross-Site Scripting.
If you know that some site you test uses the Wordpress Plugin "Live Chat Unlimited" in version 2.8.3, then it might give you some clues about what vulnerabilities it might have.
How do I collect information efficiently?
I won't make a list of tools you can use, because the tools of the trade change as new technologies emerge, and old technologies become obsolete. In general, it's a good idea to ask other more experienced pentesters questions like which tools they use for information gathering, and you will hear some tools over and over.
In general, I wouldn't get too hung up with tools at all. If you are just starting out, look at some vulnerabilities you have discovered in your tests, and what tipped you off that they might be there. Experience is the best teacher, after all.


What information can antivirus software collect? If you take Dr web for example, it lists personal data and statistics, what do those mean?

https://free.drweb.com/cureit/send_statistics/

Any information a virus can collect.

If it can scan a drive (like most downloadable AV software), then it can read that same data.

If it hooks into the operating system (like AV software with more advance features), then it has just as much access as a trojan.

Be very careful with what software you give admin rights to. In addition to that, software with kernel level access can do things that an OS might not even let an admin do.

If an AV only has permission to scan a single file (like website-based AVs that scan individual uploaded files on request), then it can still collect personal data in that file. (Names, email addresses, passwords, etc. And maybe meta-data.)

Does company X exploit or over-collect my data? isn't a question that is realistically answerable. We don't know everything proprietary software does on our computers. We can't tell what a business does with the data it copies from us. (Even if we could there is no way to know if that data will be exploited in the future.) Nor can we know whether the data they have about us won't some day get leaked to another party.


Is it a security risk, lack of knowledge for reactive action, when abuse mail is rejected? When inspecting the DNS configuration for example with dnsinspect.com, the following shows up sometimes (note I used example.com):

Accepts Abuse Address

WARNING: Found mail servers which are not accepting emails to abuse@example.com address:

primary.mail.example.com

>> MAIL FROM: <dnsreport@dnsinspect.com>
<< 250 OK
>> RCPT TO: <abuse@example.com>
<< 550 5.1.1 User unknown

fallback.mail.example.com

>> MAIL FROM: <dnsreport@dnsinspect.com>
<< 250 OK
>> RCPT TO: <abuse@example.com>
<< 550 5.1.1 User unknown

Now I figured, if you can't receive abuse emails, you won't be able to get notified by external parties (eventually automatically with services like fail2ban) because you'll never receive those emails. This way if your server is infected and is for example busy brute-forcing a innocent server that is desperately trying to notify the infected server owner, the owner of the infected server will never get notified.

Is this considered a security risk in general, in terms of a disability to detect and react in such case?

In other words I'm seeking for a way to detect abuse of my own servers, in case one is compromised. I understand that just waiting till other servers start to send abuse messages won't be sufficient and is reactive while you'd prefer a proactive method. But it will surely help in case other (proactive) measures like rootkit detection etc. failed. Now, I'm wondering if "not being able to receive that abuse emails" in case of a compromised server is a risk (read; possibly not detecting that your server is compromised)?

There are a number of alternative standard addresses that might work. For example, postmaster@example.com, admin@example.com, webmaster@example.com (full list: https://www.ietf.org/rfc/rfc2142.txt).

If that fails, you might want to look for a contract form in the website hosted on the domain, if there's any.

If you can't reach any of these, you may want to do a WHOIS query and send the abuse email to domain name registrant's email address. Even if the registrant uses domain privacy service, the privacy service usually will still forward the email to the real domain owner or have other ways to contact the real domain owner.

If that fails, you might want to try third party abuse address database like https://www.abuse.net/ and see if they have a different abuse address listed there.

If that fails, you can get the IP Address of the abusive system and reverse lookup the IP Address to get the ISP for that IP Addreas. You can notify the abuse contact address of the ISP instead. ISPs are usually more responsive to these kind of requests than individual domain owners. Most ISPs don't want abusers in their network, just as much as you don't want them abusing yours. Reputable ISPs would usually try to contact the customer, investigate the abuse, and if they consider the complaint has a case and the abuse doesn't cease, they can, at their discretion, shut down or filter the customer's internet access.

The lack of abuse@example.com addresses doesn't necessarily mean that there's nothing you can do about abuses. There's a number of alternatives you can pursue.


SSL ciphers for nginx to support CloudFlare and CloudFront Could someone suggest an optimal ssl cipher configuration for my nginx server that supports both CloudFlare and CloudFront? I have tried a few of the suggestions in other threads, but CloudFront returns errors.

Update 1:

The relevant content from my current nginx conf is below. I have tried a variety of cipher configurations from other threads on StackExchange but have had little luck. The current one is copied from the Mozilla Wiki, but I'm happy to change to try other configurations that you all might suggest. The error I am seeing is "ERROR The request could not be satisfied. Generated by cloudfront (CloudFront)" Click here for an example. Any other suggestions are greatly appreciated!

server {
    listen 443;
    server_name collin-barrett.com;

    ssl on;
    ssl_session_timeout 5m;
    ssl_session_cache shared:SSL:50m;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128:AES256:AES:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK';
    ssl_prefer_server_ciphers on;

    add_header Strict-Transport-Security max-age=15768000;
}

I don't know about CloudFlare, but Amazon CloudFront's documentation lists the protocols and cipher suites they support. As of right now, that consists of SSL 3.0 and TLS 1.0, and these common cipher suites (and RC4):

ECDHE-RSA-AES128-GCM-SHA256
ECDHE-RSA-AES128-SHA256
ECDHE-RSA-AES128-SHA
ECDHE-RSA-AES256-GCM-SHA384
ECDHE-RSA-AES256-SHA384
ECDHE-RSA-AES256-SHA
AES128-GCM-SHA256
AES256-GCM-SHA384
AES128-SHA256
AES256-SHA
AES128-SHA
RC4-MD5

I would guess that a similar configuration would also work for CloudFlare.

I second raz's question about what error message you receive.

Update 1:

I have a couple thoughts in response to your "Update 1":

First, I notice that your config sample doesn't include anything about a certificate. Huh?

Second, https://collin-barrett.com/ is behind CloudFlare. Are you having CloudFront connect to CloudFlare, or is CloudFront connecting to your real web server via some other hostname? This raises several potential issues. Among others I've probably missed:

Double-check this, but I think CloudFlare Universal SSL may only support ECDSA certificates. CloudFront's client apparently only supports RSA certificates. This would be a problem.
If you do have CloudFront connecting to another vhost, I'd like to see its config.
If it's connecting to that vhost via another non-CloudFlare hostname (backend.collin-barrett.com or somesuch), I could envision mismatches in the hostname configured in your certificate, or your vhost, or CloudFront.
Why use both CloudFlare and CloudFront? CloudFlare is a CDN already. It's redundant.

Now, I have to go. Good luck.


How to use WinObj for detecting security issues? The description of WinObj says:

WinObj is a must-have tool if you are a system administrator concerned about security

What kind of security issues can it detect and what is the rough usage?

Actually this is a debugging tool so to find security flaws, you'll need to know reverse engineering, assembly, C, C++ really well. Just using the tool and not having required skills will not help you find security issues.

In other words, WinObj allows you to visualise the Windows Object namespace, which is otherwise hard to see. Therefore any security problems which create or alter objects in the namespace become easier to find.


Has malware ever been found in a package from a large Linux distribution and what is done to prevent this from occurring? I am wondering exactly how safe are the Arch, Ubuntu, Mint and Manjaro repositories. What testing is done to ensure that a trusted user does not place a virus in a package, and how often?

Linux Mint was compromised and a backdoored ISO was deployed, Ubuntu was compromised, the entire Linux Kernel was compromised before, as were others (Debian, FreeBSD, etc). Developers protect code through checks and balances in what code is accepted into the mainline source code repository, and checksums. The issues revolve around whether or not an attacker can modify checksums without detection. Most, if not all, developers are quick to detect changes and address them accordingly.

One of the issues surrounding "how did the hackers get in" revolved around an attacker targeting a developer, then using that developer's credentials to make changes. That was addressed using two factor authentication (2FA). Which makes it more difficult than a typical attack (exploits, social engineering, brute forcing).

Each distribution is likely to have their own checks and balances in place, but it usually boils down to audits, checksums, and anomaly detection.


Is it possible to sniff HTTPS URLs? From many posts, I know that almost everything in HTTPS or SSL connections is encrypted. Still, I am wondering, if it is possible to get the URLs out of such a connection if the computer that opens the connections is on a home network and access to the wifi router including a Unix based OS of the router is given?

I am not talking about the content of any messages, but only the domains that are visited in a browser an possibly the rest of the URLs like domain.com/thiscategory/site123.

TL;DR An attacker cannot see anything past the domain.
Structure of a HTTP request
HTTP works by sending two things to a website: the method, and the headers. The most common methods are GET, POST, and HEAD, which retrieves a page, transfers data, or requests only response headers, respectively. TLS encrypts the entirety of HTTP traffic, including the headers and method. In HTTP, the path in the URL is sent along with the header body. Take this example, with wget loading the page foo.example.com/some/page.html. This text, as ASCII, is sent to the server:

GET /some/page.html HTTP/1.1
User-Agent: Wget/1.19.1 (linux-gnu)
Accept: */*
Accept-Encoding: identity
Host: foo.example.com

The server will then respond with an HTTP status code, some headers of its own, and optionally some data (such as HTML). An example, giving a 301 redirect and some plain text as a response, may be:

HTTP/1.1 301 Moved Permanently
Date: Wed, 27 Dec 2017 04:42:54 GMT
Server: Apache
Location: https://bar.example.com/new/location.html
Content-Length: 56
Content-Type: text/plain

Thank you Mario, but our princess is in another castle!

Which would tell the client that the correct location is elsewhere.
These are the headers sent directly to the site over TCP. TLS works on a different layer, making all of this encrypted. This includes the page you are accessing with the GET method. Note that, although the Host header is also in the header body and thus encrypted, the host can still be obtained through rDNS lookup on the IP address, or by checking SNI, which transmits the domain in plaintext.
Structure of a URL

https://foo.example.com/some/page.html#some-fragment
| proto |    domain    |     path     |  fragment  |

proto - There are only two protocols in common use, HTTP and HTTPS.
domain - The domain is example.com and *.example.com, detectable with rDNS or SNI.
path - The path is completely encrypted and can only be read by the target server.
fragment - The fragment is visible only to the web browser and is not transmitted.

What an attacker can see
So what can an attacker see if you make a request over HTTPS? Let's take the previous hypothetical request from the perspective of a passive eavesdropper on the network. If I wanted to know what you are accessing, I have only limited options:

I see you making a web request encrypted with HTTPS going to 203.0.113.98.
I see that the destination port is 443, which I know is used for HTTPS.
I do an rDNS lookup and see that IP is used for example.com and example.org.
I look at the SNI record and see you are connecting to foo.example.com.

This is all I could do. I would not be able to see the path you are requesting, or even what method you are using, short of heuristic analysis based on the sizes of the data being sent and received, called traffic analysis attacks. For a large service like Wikipedia, I would have no idea what article you are viewing based on analysis of the unencrypted data alone.
An important note about referers on older browsers
Even though HTTPS encrypts the path you are accessing, if you click a hyperlink within that site which goes to an unencrypted page, the full path may be leaked in the referer header. This is not the case anymore for many newer browsers, but older or non-compliant browsers may still have this behavior, as will websites which set the HTML5 referer meta tag to always send the information. An example sent unencrypted by a client go from https://example.com/private/details.html to http://example.org/public/page.html in such a case would be:

GET /public/page.html
Referer: https://example.com/private/details.html
User-Agent: Wget/1.19.1 (linux-gnu)
Accept: */*
Accept-Encoding: identity
Host: example.org

As such, navigating from an HTTPS page to an HTTP page may leak the full URL (excluding the fragment) of the previous page, so keep that in mind.


apple.com exploit attempt? I recently browsed to apple.com; and the page crashed a few times, then after I reloaded I was given this alert after my browser attempted to redirect to res://ieframe.dll/acr_error.htm#apple.com,http://www.apple.com/:

Is this cause for concern, or a false alarm?

nslookup apple.com provides

Server:  UnKnown
Address:  192.168.1.1

Non-authoritative answer:
Name:    apple.com
Addresses:  17.142.160.59
          17.178.96.59
          17.172.224.47

While the alert is alarming, based on the information provided, it does not appear to be of concern.

When IE restarted, it attempted to reopen the page it was last on, which was apple.com. res://ieframe.dll/... is how IE reloads the last page it was on. Malware Bytes caught this dll loading and alerted on it.


Elcomsoft Advanced EFS Data Recovery The Elcomsoft "Advanced EFS Data Recovery" whitepaper says

  First the program tries to do this automatically, for example trying to extract the password from cache or system files, checking simple combinations (such as password=username) and then conducts an attack using a medium-sized built-in dictionary.

What's the probability that Elcomsoft can find a cached password on Windows 7?

I don't think you're going to come up with a numeric probability value, here. But there are in fact several places where passwords get cached temporarily when they're used. The chances are higher if you use the same password in multiple places, and many tools for this purpose also scan the drive for anywhere you might have a copy fo the password stored somewhere -- such as saved credentials, Word documents, email conversations, etc. All of this automated, of course. If you have the person's computer in your posession, your chances of retrieving their password is significantly higher than if you don't.


Do snowshoe and hailstorm spammers use auto-generated domain names? My question is about snowshoe and hailstorm spam emails. Do snowshoe and hailstorm spammers use auto-generated domain names?

Many of them almost certainly do.  I don't have a specific example to hand, but I have seen spam campaigns where the domains were made of several words, and often had the same words in different domains, leading me to believe that they were using a (relatively short) wordlist to generate the domains used for spamming.


Will it be a crime if I post data into someone's website using cURL? I found a website which is not secure and tried to post a form on that site using cURL request in PHP and it worked successfully.

However, that is a simple site with contact form and no special or secure data. Anyone can fill that form. I just did that with curl with a loop of 100.

Is this a crime?

Most browsers have developer tools which allow you to monitor all HTTP(S) requests sent by the browser, including an option to copy the requests as a cURL command. If you execute the request via cURL, it's indistinguishable from a 'real' browser request. Therefore, that is certainly not a crime.

If you're looping cURL requests, you're essentially trying to perform a Denial of Service attack; many countries/states have laws which state that this is a crime. Though 100 requests are not likely to constitute a successful attack, all it might do is fill the inbox of the mail account which receives completed forms.


How does Netflix tell I'm behind a vpn managed with OpenVPN but not other managers? I run Ubuntu 18.04 and use a VPN service. If I use OpenVPN to manage the connection and connect to a given server, then I can browse the internet as if I'm from that location, except for Netflix, which displays the "we've detected a proxy" message.

However, if I use the VPN service's own connection manager and connect to the same server, Netflix doesn't detect I'm using a proxy.

How can Netflix detect this in one case, but not the other?

Assuming that you really end up with the same VPN endpoint the most likely explanation is that you local OpenVPN setup is not strict enough and that you are either using a DNS server without VPN (i.e. some local DNS server in your network) and/or that IPv6 is not covered by your setup and thus bypasses the VPN too. Both are typical configuration problems.

Both of these problems are already discussed on this site, see for example Open VPN has DNS leak and My ISP provides IPv6 natively but my VPN does not support IPv6. You can also check your setup with sites like ipleak.net.


What does `&==;` mean with regard to Python Django and bypassing WAFs? I'm reading someone's slides on bypassing WAFs.

  &==; : Python Django between parameters;
  FooBar==POST verb : Apache with PHP;
  <%I%M%U011e>==<IMG> : IIS ASP Classic;
  ;/path1 ;foo/path2;bar/;==/path1/path2/ : Apache Tomcat;

On one page he mentions the string &==;-. Does anyone know the meaning of "between parameters"?

Read it as: & == ;

This bullet point just means that the Django framework for Python parses both an ampersand (&) and a semicolon (;) equally as valid separators of query parameters in a given URL.

Consequently, the following URLs would be treated identically:

https://example.com/foo/bar?x=y&name=peter&debug=1
https://example.com/foo/bar?x=y;name=peter;debug=1

This is remarkable because other frameworks might not recognize the semicolon as a separator and read the second query string as a single parameter x with the value y;name=peter;debug=1. This behavior might in turn confuse WAFs which is likely why it's listed on your slides.


Weird request to NodeJS Webserver So logging all the requests I get things like this:

Mon Sep 07 2015 21:30:04 GMT+0200 (CEST) Received request for http://testp4.pospr.waw.pl/testproxy.php

also for http://zc.qq.com/cgi-bin/common/attr?id=260714&r=0.9927029395516237

My simple server:

var server = http.createServer(function(request, response) {
    console.log((new Date()) + ' Received request for ' + request.url);
    response.writeHead(404);
    response.end();
});

Should I worry? What could that be?

What you're seeing is an "open proxy" test: your webserver is being scanned to see if it can be used as a general-purpose HTTP proxy.

The requests are not something to worry about in and of themselves, but they reveal a weakness in your server: you're not logging what response the server makes to the request.  It should be a "404 not found", but you don't have the log entries to prove it.


Is `arc4random` secure enough? I need to generate many many initialization vectors and session keys in C++ code. I am wondering if arc4random is up to the task. Last I heard, there are many weaknesses in the RC4 cipher. Should I stick to reading from /dev/urandom instead?

I am only targeting Unix-like OS, not Windows.

Both arc4random and /dev/urandom have histories of problems.  Some systems have reimplemented arc4random without RC4, but some systems kept RC4.  I prefer arc4random over /dev/urandom, but if your goal is to avoid RC4, and you have a system where arc4random uses RC4 and /dev/urandom avoids RC4, then you would prefer /dev/urandom.

These systems have arc4random without RC4:

OpenBSD 5.5 (May 1, 2014) switched arc4random to ChaCha20.
NetBSD 7 (Oct 8, 2015) switched arc4random to ChaCha20.
libbsd 0.8.0 (Nov 30, 2015) switched arc4random to ChaCha20.  (libbsd provides arc4random for systems like GNU/Linux.)
macOS 10.2 (Sep 20, 2016) seems to have switched arc4random to AES.
Android (unknown version) switched arc4random to ChaCha20.
Illumos (unknown version) added arc4random with ChaCha20.

These use RC4: As of 2017, both DragonFly BSD and FreeBSD kept arc4random with RC4.

These problems can happen with arc4random: Fortunately, none of these problems happen if your system has fixed arc4random.

arc4random might use RC4.
arc4random might use an improved RC4 that discards the first few hundred bytes after keying the stream, but it might not discard enough bytes.
arc4random might fail to detect a fork.  After the fork, both processes would get identical random numbers.
arc4random might fail to get entropy from the kernel, then seed itself using only gettimeofday and getpid, then generate predictable and insecure numbers.  In DragonFly BSD and FreeBSD, the sysctl to get entropy should never fail, so arc4random should never reach the code to use only gettimeofday and getpid.

These problems can happen with /dev/urandom: Unfortunately, some of these problems don't have a fix.

/dev/urandom can use RC4.  It did in OpenBSD before 5.5.  In most other systems, /dev/urandom never used RC4.
/dev/urandom might not exist.  This might happen inside a chroot.  Some setups don't allow device nodes like /dev/urandom inside the chroot.
The program might fail to open /dev/urandom because it has reached the limit on file descriptors.  This might not be a problem if the program doesn't open lots of files, or if it opens /dev/urandom early.
Multi-core machines might slow down, if multiple cores are reading /dev/urandom, but the kernel uses only core to generate the random numbers.  This might not be a problem if you have few cores or don't need too many random bytes.

Because of the last 3 problems (chroot, fd limit, multiple cores), I prefer arc4random over /dev/urandom.

There is a third option: Instead of arc4random or /dev/urandom, you might use a crypto library with a secure random number generator.

GnuTLS uses ChaCha or AES for random numbers.  NSS uses SHA-256 for random.  OpenSSL seems to be switching from SHA-1 to AES for random.  All three libraries (GnuTLS, NSS, OpenSSL) seem to avoid RC4 for random numbers.

LibreSSL might call arc4random and use RC4 in systems like DragonFly BSD.  Therefore, you can't trust LibreSSL to avoid RC4.

Some people have spread doubt about random numbers from userspace.  These people oppose userspace generators (like arc4random, GnuTLS, NSS, OpenSSL, and OpenSSL again) and prefer /dev/urandom for random numbers.  This might have influenced Ruby to prefer /dev/urandom over OpenSSL.  I prefer the userspace libraries because of my above list of problems with /dev/urandom.


Reverse shell on a web server behind Netscaler How possible is it for a reverse shell to connect back to the attacker if the vulnerable web server only has Http ports open like 80 and 443 through the Netscaler behind the perimeter firewall?

Would the web server be able to connect back, for an example, to an attacker port 443 from a random port? If not would a bind shell work on the busy ports mentioned?

Assuming that the Netscaler (or other load balancing appliance) is configured properly and the network architecture is such that the target server cannot bypass the load balancing layer to directly reach the internet, you cannot expect to get a normal reverse shell to work.

There are a few ways you can approach this problem:

If the Netscaler appliance is configured to allow SSH forwarding for remote management purposes, then you may be able to have the payload add a user.
Have the payload drop a webshell onto the system which allows for interactive access to be tunneled through the load balancing layer.
Exploit the vulnerability repeatedly and have the payload tunnel data back through an out-of-band channel, e.g. DNS requests to subdomains of a system where you control the nameserver.
Attempt to attack the Netscaler itself. There's an old Netscaler management application written in Java which uses a custom protocol on top of TLS, but the protocol is fairly trivial and there's no account lockout, so bruteforce is trivial. The server always has the management port open on the internal side and (last I checked) there's no way to disable it.