Prevent request forgery attack I don't know if I used the term correctly but basically this is the scenario:

I am working at an application witch on every computer install must make a request to a server notifying the server that the app installed properly.The system I use currently has a checksum value that is calculated on client side and on server side that will validate an install.The problem is someone can forge the request decompiling the application and calculate the checksum using the same algorithm I use for calculating it.

So besides using a RSA encryption is there a way I can protect my application from such an attack?

This is another variant on the classic trusting-the-client problem. You have to give the client machine enough information to generate the signature, at which point if the attacker has access to that machine you lose. RSA won't help you there.

To make it work you would need to ensure that the operators of the target machines don't have access to the application. ie: they aren't administrators, the application gets installed by another user such Local System, and the shared key (or public key for RSA) is not left lying around somewhere they can see it when the application is ready for use.


Is there any security benifit to sent email message only as attachement? A well known company in Oil and Gas field, sends the email message as PDF attachment, with brief explanation, here is an example:

 Dear  Mr Name,

 Please review the attached document acknowledging your recent activity on
 .....

 Regards,

 Company Recruiting Team

Is there any security benefit behind this?

No. In fact I'd be extremely hesitant to open one of these PDFs.

PDFs are notorious for spreading malware due to the various sandbox escape vulnerabilities that have arisen over the years.

Emails don't necessarily verify the sender either - it's possible via DKIM but generally anyone could have sent that email to you (potentially loaded with malware) claiming it was sent from the company you trust.

It's a common trick to forge an email from a well known bank, attach a PDF which spreads malware then say in the message "see attached document to claim refund" or something similar.The message you posted reads suspiciously like that!


Online Payment Gateway Requirements I have been looking at an online payment gateway, authorize.net, and specifically their Direct Post Method. This method would allow me to create a form on my server, then submit the post parameters directly to their server for processing. So you never actually leave my site as a customer, but my server can only see the response, not the initial payment information.

A question I have thought about is PCI compliance. I have been reading in the comments of this authorize.net blog. There is an argument over whether or not the server that has the form needs to be PCI compliant. Some say yes, because the form is on your site that has your URL and there is credit card information. Others say no because the form is submitted directly to authorize.net and the credit card information never even hits the merchant's server.

I have read in a few places on their site that Direct Post Method will "simplify merchant PCI compliance" or it will "relieve some of the worries about security". How exactly is PCI compliance simplified? So my question is, does my site need to be PCI compliant and if so how can this simplify it?

A related question is the transaction key. Authorize.net says to securely store the key. How are keys securely stored on a server? (without an HSM) Is this key considered part of PCI?

If you're servers do not store, process or transmit cardholder data in any capacity at any time, your systems are not in scope for PCI compliance and you've effectively outsourced the handling of such data to authorize.net - this means PCI is simplified as you've a reduced scope and would complete a less onerous Self Assessment Questionnaire (SAQ). As a merchant you need to be compliant rather than your site needing to be compliant. How you handle cardholder data dictates which SAQ you complete - if you've outsourced the cardholder data handling, you'd complete SAQ A which is pretty simple!

Visa and MasterCard have guidelines on how web applications should be secured when the transaction handling has been outsourced such as using hosted payment pages. The worry is that the application could be manipulated and cardholder data transmission redirected (or copied) to a third party.

Requirements include secure development lifecycle, vulnerability scanning, logging and file integrity monitoring.

You should consider storing the transaction key separate to the application itself such as encrypted within the database or in a separate file store with strong access controls.


Google Chrome Linux with Activity of Unknown Device I've recently noticed a strange comportment on my Google Chrome Browser with GMail, where suddenly appeared a connected Unknown Device, with a double connection and with the same IP than mine, looking at the GMail history Details of accesses, and I don't know where is the origin of the problem.

Illustration of the problem (Portuguese language location):

I've already deleted the Profile, following the below advice teached in the Ask Ubuntu Section:

https://askubuntu.com/questions/391858/clearing-all-private-user-data-from-chrome-from-the-command-line

*( Clearing all private user data from Chrome from the command line - Ask Ubuntu )

For the default Chrome configuration, run

 rm -rf ~/.config/google-chrome/Default/

and

rm -rf ~/.cache/google-chrome

, and the strange described problem doesn't gone yet until todays.

This below Topic, also doesn't help to resolve or remedy the problem:

<https://webapps.stackexchange.com/questions/105037/remove-access-for-unknown-devices-in-account-activity>

*( security - Remove access for unknown devices in account activity - Web Applications Stack Exchange )

. Maybe it's a viruse/malware on my Debian? I'll try to scan my computer, also verifying the Debian 7 Partition with ESET SysRescue:

<https://www.eset.com/int/support/sysrescue/>

, to know if I'll discover some infection, some trace of hidden prague on my system. I think that this symptom is uncommon and I suspect an infection, and it's the first time that I see this behavior on Linux.

Could someone here help me to investigate the problem? This might not be malware related, only Network issues on a last valid hypothesis. Only rests for me to let unoccupied an USB Flash Drive to make a Bootable AV USB Key for scan my computer, including the Bootable AVs as Kaspersky Rescue Disk or the ESET SysRescue Linux-based Security Distributions (the best Vaccines encountered on the market, according to all my searches).

Obs.: Maybe this is a prank of my older brother, accessing the Debian partition with Ubuntu and infecting it with a virus / malware. Or is it fruit of a infection of a possibly hidden extension on the latest 32-bit version of Google Chrome for Linux (.deb package), that was acquired when I was browsing on some harmful websites? I've not managed to encounter a guide with steps, and with a list of probable related causes for resolve the case.

Waiting a return as soon as possible.

Thanks.

@lhvf.

I assume you mean that the unknown device has your same home IP address -- so, not 192.168.x.y but something belonging, say, to Telecom Brasil.

If this is the case, the problem lies not in your Chrome browser or desktop Debian distribution, but in your home or nearby. Something is accessing your GMail account from your wireless Access Point, which implies it knows the access codes for both.

The most likely explanation is that you have GMail on your WiFi-connected smartphone also.

Or you could have some "smart" device somewhere - an Android TV maybe - that's synchronized with your Google account.

Otherwise, it's someone else's device. This is, of course, potentially very bad. Try changing the passwords on both the account and the access point, using two different, robust, non-guessable passwords, ensure the access point is not vulnerable to some exploits (just google "BrandOfYourDevice exploit" or "BrandOfYourDevice security vulnerability"), it is not accessible from the outside, and is configured for WPA2 security.


Can a whitespace regex character be used to perform a javascript injection? if I want to validate the input of a <textarea>, and want it to contain, for example, only numerical values, but even want to give users the possibility to insert new lines, I can selected wanted characters with a javascript regex that includes even the whitespace characters.

/[0-9\s]/

The question is: do a whitecharacter can be used to perform injections, XSS,even if I think this last option is impossible, or any other type of attack ?

thanks

update

hi Polynomial, thanks for the advice, along with javascript there must be a php server side control, you're right, but my question it's about a case in which I just want to retrieve, or write, some file info through javascript, for example via ActiveX objects, in that case there could be a saved file with malicious code in it, that's not been filtered at the moment of input filtering.

In practice, this is very unlikely to permit an injection attack.

However...   In theory, there are farfetched situations where whitespace could potentially lead to an injection attack.  For instance, suppose that the program executes a command like the following:

echo Something bad happened: code $n >> logfile

where $n is the request parameter you sanitized above.  If the attacker uses a value like 42\n17 (where \n represents a newline), this will turn into two commands:

echo Something bad happened: code 42
17 >> logfile

The first command will execute, but its output will not be saved.  The second command will trigger a command not found error (there is no program called 17), so it will not execute.  The consequence is that no message will not be appended to the logfile, contrary to the programmer's intent.

This is very unlikely, in almost any program you are likely to run across.  So, probably you can ignore it.  But... in theory, I suppose it could happen.

P.S. Your regexp looks dubious.  As @Rook says, it only matches a single character.  Also, depending how it is used, you may need to anchor it.  Maybe you meant something like this:

/^[0-9\s]+$/


Benign, Malicious Domains and Definitions I am working on a research project where we segregate domains used for malicious purpose from benign domains.

However, my guide does not want the term malicious domain and benign domain in the paper. This is because, according to him, a domain in itself does not have an intent (which is quite correct), however it is the tool of the adversary's hand, its intentions directly connected to the adversary's ideals.

I am a bit torn here - I have seen every research paper talking about malicious and benign domains without going into so much detail. How do I establish the definitions of benign and malicious when it comes to domains?

So how can I formally define a benign and malicious domain?

Was the intent behind the registration of the domain name to harm others? Then it's a "malicious domain" by definition.

But can the intent be so clear from the start?

"Benign domain" sets up perhaps a poor dichotomy. A domain with good intent may be compromised to act with bad intent. Is it still a "benign" domain?

You appear to me to set up the correct model at the start of your question: "domains used for malicious purposes". It makes it about what it did, which is easier to define and delineate. You can shorten this to "malicious domain". It also allows you to define those domains that have been compromised to perform malicious acts: "compromised domains". "Benign domains", then, can be defined as those domains that are not known to have acted maliciously. That last one gives you some room to be unsure about their intent or use.

It does depend a lot on how you are defining "malicious" and "benign" for the purposes of your paper.


Why don't browsers trust the US Treasury? (inspired by How do you tell a website they have expired security certificates? )

Why don't major browsers trust the US Treasury PKI certificate authority by default?  I know that the government isn't necessarily trustworthy, but surely they're at least as trustworthy as 'GoDaddy.com'.  Are there technical or systemic deficiencies in the US government's granting of certs or is this based on something else?

It is not that the browsers are unwilling to include this PKI. But they will only include a PKI which gets regular audits and fully conforms to the rules of the CAB browser forum. Acording to this bug inclusion process in the Mozilla trust store (i.e. Firefox) was started 8 years ago and is still an ongoing process. For all the details see the bug itself.


How to disclose a security vulnerability in an ethical fashion? How to disclose a security vulnerability in an ethical way? I've heard there are various schools of thought on this topic. I'd like to know the pros/cons of each.

You should let the developer(s) know privately so that they have a chance to fix it. After that, if and when you go public with the vulnerability, you should allow the developer enough time to fix the problem and whoever is exposed to it enough time to upgrade their systems. Personally, I would allow the developer to make the announcement in a security bulletin in most cases rather than announcing it myself. At the very least, I would wait for confirmation that the vulnerability has been fixed. If you have time and have access to the source code, you could also provide a patch.


Java code signing vs. sandboxing I'm trying to understand the rationale behind Java Applet development these past few years. Back in the old days, most Applets were unsigned, and the code for these was run in a sandbox where barring bugs in the sandbox itself it could do no harm. If some applet wanted more privileges, the author could sign the code and the user could decide to trust that author and run the applet without the strict sandbox restrictions.

Recently, however, running unsigned code in sandboxes appears to be very hard. In my experience it requires reducing the security setting and establishing exception rules. As a consequence, more and more applets are being signed, since the user experience there is better. So more and more applets are running outside a sandbox, often with no good reason for it except that it's easier to explain to users that they should simply click on “Allow” (as opposed to say adding a domain-based exception rule).

Did I present the development correctly? Or did I just at some point somehow garble my Java setup to a point where it would refuse running sandboxed Applets for me personally?

What's the rationale here? How is running signed applets from unknown people without a sandbox any safer than running unsigned applets from these same people in a sandbox? Is the sandbox really that buggy?

The Java Sandbox was bypassed a lot in the last years and Java established itself as one as the major attack vectors in drive-by-downloads. To mitigate the problem Oracle decided to only allow applets signed by a trusted CA (i.e. no unsigned or self-signed), since this is at least increases the efforts needed by the malware author. Also, certificates used for signing can be revoked to limit the impact of a certificate used for signing malware. This change to the platform was done in 2013 with Java 7u21.

This does not mean that all these applets run outside the sandbox. To cite oracle:

  As of 7u21, signing no longer automatically equates to privileged execution, ..

Thus if the applet uses privileged execution depends on the exact way it was embedded and on the permissions it implicitly or explicitly requests. With Java 7u51 further restrictions were added and all applets must now contain the list of permissions they need.

Apart from that it is recommended to remove tje Java plugin completely for security reasons or at least make applets click to play, which is the default in several browsers now.


SHA-1 deprecation impact on personal PKI certificates I understand that most commercial browsers will stop trusting websites with SHA-1 PKI certificates by Jan 2017 so it is critical for websites to update to SHA-2 by that time. My question is, is it also critical for end-users to update their personal PKI certificates to SHA-2 by Jan 2017 to still be able to authenticate themselves to websites requiring certificate-based authentication? That is, will the browsers also stop supporting sending of SHA-1 certificates to websites during mutual authentication?

Web browsers will accept SHA-1 client authentication certificates. However, Web server may reject this certificate if authentication server (domain controller, for example) does not support SHA-1.

I think that most authentication servers will accept SHA-1 client certificates (at least Active Directory will do), because they are not subject of depreciation policy, but I would strongly recommend to upgrade your CAs to sign certificates with SHA-2.


How to use an OR condition with the content of a snort rule I understand that if you specify multiple contents then the rule triggers only if ALL the content conditions are satisfied.

But I want to create a rule that will trigger even if any one of the content keywords are detected. Note that it has to be in a single rule. Perhaps something like this:

alert tcp any any -> any 21 (msg: "FTP traffic"; content: "USER" OR content: "PASS"; sid: 666;)

What I am trying to achieve is a rule that block only FTP traffic on port 21 but allows other traffic. So I figured I could just list all FTP raw commands in the content. Note that it has to be a SINGLE rule.

Thank you

This concept will do the trick for you.

alert tcp any any -> any 21 (msg:"FTP traffic"; pcre:"/USER|PASS/i"; sid:666; rev:1;)

This is a case-insensitive (/i) Perl Compatible Regular Expression (pcre) match for USER or (|) PASS.

If you want add additional commands then simply tack them on to the end of the regex like...

/USER|PASS|PASV|.../

To my knowledge having an OR operator for content matches is not possible. Instead make two rules (which you indicated you don't want to do).

Looks for USER
Looks for PASS

I have seen many people indicate that using PCRE in Snort is expensive and should be avoided. Supposing it's used effectively I don't think there's a huge issue but have never captured performance metrics since I rarely have used PCRE for rule matching myself. If you do use the above PCRE rule than strongly consider beefing it up with content and flow.  How it's currently written Snort will inspect every packet that matches the header (tcp any any -> any 21)!

http://manual.snort.org/node32.html#SECTION004523000000000000000
http://manual.snort.org/node32.html#SECTION00451000000000000000
http://manual.snort.org/node33.html#SECTION00469000000000000000

Without more details of where you are/where you're trying to get to/what you have available you should also check out the FTP preprocessor to see if it can help achieve your overall goal.

http://manual.snort.org/node17.html#SECTION003210000000000000000


How to create a proxy so that no website or web service can know that I am connecting through a proxy? I want a proxy, preferably my own but I would be glad if there is a reliable service already, that is undetectable. Obviously, it does not send X-Forwarded-For. But it has to be much more than that to be undetectable. I have read the following in different online articles.

The IP should not belong to a known list of proxy servers.
Not detectable through proxy ports
Not through DNS associated with proxies
I will be connecting mostly to HTTPS websites. So the proxy should not be detectable by bypassing HTTPS traffic
Datacenter IPs are now a telltale sign that I am using a proxy or VPN, so how to solve this and use a residential IP.
Proxy should not be detectable through any other mean not mentioned above.
I know how to disable WebRTC. Disabling JavaScript is not feasible as most websites will not work without JS.
Encryption is not needed. Encryption through OpenVPN introduces its own issues of detection - or this is what I have read.

Please note that I am not an IT expert. I have researched and gathered the above information. All I am able to do is follow a step-by-step process.

Running a proxy server
As schroeder says, getting a residential IP would be the real issue. Everything else is simple. You can register a VPS and put a proxy application on it, such as Tinyproxy, a lightweight HTTP proxy that can be configured not to advertise the fact that it is a proxy server. At the worst, it would be advertising in its rDNS that it is a VPS. The ports used can also be easily customized to avoid detection based on common ports. Note that Tinyproxy in particular does not support authorization, so active probing (a technique used by, among others, China) could attempt to connect to it using the CONNECT method on all ports to discover if the server is running an instance of Tinyproxy.
Running a proxy simply involves installing a proxy daemon on a server, configuring the ports you wish to use to connect to the proxy, and opening the ports in the firewall. It's that simple. This can be done on a dedicated server, a VPS, or even a shared shell account. All you need is basic understanding of running a server, and the ability to open ports if they are firewalled off otherwise.
IP and DNS leaks
Preventing proxy leaks is an entirely different class of problems. The best solution for that wouldn't be to disable JavaScript (which doesn't have a built-in way to bypass proxies anyway), but to set a firewall rule that blocks all traffic not going to the proxy server. This prevents both malicious exploitation and accidental misconfigurations from bypassing the proxy and revealing your IP.
HTTP proxies do not require you provide the IP address, so the domain will be resolved by the proxy server itself. This is also true for SOCKS5 and SOCKS4a proxies. With an HTTP proxy, requesting an example website is done by sending headers such as the following to the proxy:
CONNECT server.example.com:80 HTTP/1.1
Host: server.example.com:80

It is up to the proxy server to resolve server.example.com and relay the response to you.
Getting a residential IP
Using a residential IP generally requires you run a proxy server on a computer connected to a residential line. Unless you have someone who is willing to do that for you, there is no simple, legal solution. If you have online friends who may not mind running a proxy for you, you could take advantage of that. For example, I have a friend in Moscow (Russia) who was willing to run a proxy server on his own system and allow me to connect to the internet through it.
There are several commercial proxy services that can provide residential IPs, however they are rather sketchy at best of times, and certainly are not what I would call "trustworthy". Many of these services are likely to run proxy servers on a botnet and sell access to the proxies for a profit. While this may give you a residential IP (and "reputable" services will guarantee that IPs will not be shared, or will be minimally shared), it is likely that it is running on a compromised machine. An example is VIP72, which has been known to (perhaps unwittingly) utilize botnets.
It is also possible to exploit consumer routers and run lightweight proxies on them. Many routers have vulnerabilities in exposed web interfaces, or even just use default credentials. As the majority of routers are rarely if ever updated and behave as magical black boxes to their owners, detection is exceptionally rare. Scanning the IPv4 range for particular router vulnerabilities can prove very fruitful. Relevant vulnerabilities are often posted to mailing lists such as Full disclosure. Note that this information is for educational purposes only, as hacking routers is illegal in many jurisdictions.

Encryption is not needed. Encryption through OpenVPN introduces its own issues of detection - or this is what I have read.

That isn't true. The OpenVPN protocol does not hide the fact that it is a VPN tunnel from your ISP, but the website you connect to will not know anything about that. The encryption used by OpenVPN (or other encrypted tunnels such as IPSec) terminates at the VPN server. There are other ways to detect that a VPN is in use though, so a (secure) proxy can actually be more stealthy.


Named curve value 0xffff in 'Server Hello' message I'm using the RSA BSAFE Crypto-J 6.2 JCE provider in Java as SSL/TLS server (in FIPS 140 Compliant Mode for SunJSSE).

It seems like at least Chrome and Firefox cannot establish a connection if TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b) is used.

The error in Firefox when connecting to the server is: "sec_error_unsupported_elliptic_curve"

With the error message as hint I looked into the handshake (using Wireshark). In the "Client Hello" I see 3 curves:

Elliptic curve: secp256r1 (0x0017)
Elliptic curve: secp384r1 (0x0018)
Elliptic curve: secp521r1 (0x0019)

In the corresponding "Server Hello" message I see the named curve value 0xffff

Named Curve: Unknown (0xffff)

As a result the browser terminates the connection with the above mentioned error message.

If I use standard Java on the server side (no BSAFE Crypto-J provider) the named curve in the "Server Hello" is:

Named Curve: secp256r1 (0x0017)

... and the handshake finishes successfully.

The question now is, what is the meaning if 0xffff?  Does it mean that the server does not understand the set of curves suggested by the client? I looked into section 5.1.1 of RFC4492 but I couldn't find anything about the value of 0xffff
If someone has experience with RSA BSAFE Crypto-J and Java running in FIPS mode. Anybody else who ran into that problem and found a solution.

Look at RFC4492 Section 5.1.1 that you mention in your post, we see the following structure:

enum {
        sect163k1 (1), sect163r1 (2), sect163r2 (3),
        sect193r1 (4), sect193r2 (5), sect233k1 (6),
        sect233r1 (7), sect239k1 (8), sect283k1 (9),
        sect283r1 (10), sect409k1 (11), sect409r1 (12),
        sect571k1 (13), sect571r1 (14), secp160k1 (15),
        secp160r1 (16), secp160r2 (17), secp192k1 (18),
        secp192r1 (19), secp224k1 (20), secp224r1 (21),
        secp256k1 (22), secp256r1 (23), secp384r1 (24),
        secp521r1 (25),
        reserved (0xFE00..0xFEFF),
        arbitrary_explicit_prime_curves(0xFF01),
        arbitrary_explicit_char2_curves(0xFF02),
        (0xFFFF)
    } NamedCurve;

It would seem to me that 0xFFFF is a reserved value that is (maybe mistakenly?) sent to indicate that the server doesn't support ECC, or to indicate the end of the array of curves.

It's possible that the BSAFE Crypto-J provider isn't properly configured.


Pentest for Embedded Linux Device First things that I am trying to discover using pentest:

Files permissions (are sensitive files in my Linux build secure from exploits)
Are programs running under users (e.g., something running under root user hen it should not)

Is there any framework/tool that can be employed to discover weaknesses in the above two areas for an Embedded Linux devices?

P.S: Consider me beginner in the area of penetration testing. I am trying to discover basic vulnerabilities and to fix those.

Embedded systems are usually on a plain of their own due to them being highly customized to the specified needs subject to the use case scenarios. It really depends on how the system is going to be used and how the system is built.

For example, if you're using Wind River Linux on an embedded system, there is no single use case / misuse case that we can plan for considering it's going to be a custom build depending on the customers needs and as such, there is only so much we can do. You need to define your requirements and then define cases in which you can defeat the security requirements (Misuse cases). From there you can dictate attack vectors and start pen testing.


Setting certain response headers only if Referer is invalid I came across this technique and I'm curious if there are any flaws in this design. A site sets the X-Frame-Options response header to deny only if the Referer header is not define or does not match the site's domain. When the Referer header is set to the correct domain, the X-Frame-Options is not defined in the response.

Is there a flaw in this? I feel like depending on the Referer header is not enough here to prevent clickjacking but can't think of a real-world use case.

Any headers provided by the client can be spoofed. Using cURL, I can craft an HTTP request to contain any headers I want. Depending on the referrer is clever, but clever is not good enough. If I'm crafting the request as an iFrame, I have full control over the request header.

Here's a use case, courtesy of the brilliant minds at Stack Overflow: https://stackoverflow.com/questions/13432821/is-it-possible-to-add-request-headers-to-an-iframe-src-request

Evil Website --> AJAX script to preload headers -> Your site.

Add x-frame-options on every page in every case, and use framebusting scripts for older browsers.


Trip to China - safeguarding phone and laptop I am going to China for a 2 week vacation in a month

I will be taking a Google Pixel  with a Verizon SIM and using it while there. I assume that if I don't use a local SIM, it would be difficult for someone to put malware on my phone but wanted to confirm if I am right about this
Are there instances of people being asked to unlock phones and laptops at the airports in China?
I was thinking of taking a Chromebook since that has full disk encryption. I read that it's easier to do a full reset on this than a Windows laptop. I have also read that malware can't be installed through USB on a Chromebook

I would not consider myself to be important to anyone in China and have a very run of the mill job.

I am trying to balance the likelihood of getting malware with convenience which comes from a phone or laptop. Have already signed up for 2 VPNs as well.

Would appreciate any suggestions about this or strategies people use when visiting China.

I flagged this as a duplicate because the elements of your question have been asked many times before; it's nothing personal. The linked thread should give you a good idea of what you're facing with your laptop (Chromebook or not) since it's easy to shoot yourself in the foot with bad OPSEC-- you're competing with the combined might of both corporate espionage and national intelligence agencies. Don't make the same mistakes that guy did, like plugging right back in to the corporate network upon return.

Even if you're "nobody important," don't assume you're not a target. You still have value as a patsy. Your credentials are desirable because if captured, they can allow foreign agents (corporate or government) access to your corporate network, within which they'll exfiltrate anything they can touch. The added bonus is that since you're "nobody important," your company may be unlikely to keep an eye on "your" activity-- unlike a higher-profile employee like a lead engineer, sysadmin or executive.

  I assume that if I don't use a local SIM, it would be difficult for someone to put malware on my phone but wanted to confirm if I am right about this

Consider this-- the Chinese government is trying to move to a cashless society by forcing everybody to install WePay on their smartphones. While it serves a purpose (convenient payments), it also makes it so that in order to function at all in society and buy basic goods, you must consent to backdoor/keylog a device critical to your daily operations and have all your transactions monitored remotely.

In practice, it doesn't matter what SIM you use if you end up voluntarily installing government-controlled malware just to pay for McDonald's. That said, plenty of urban centers still take cash, but be wary of the seeming obligation to install random apps to ride the subway, buy things, whatever. Each one compromises your OPSEC.

  I was thinking of taking a Chromebook since that has full disk encryption. I read that it's easier to do a full reset on this than a windows laptop. I have also read that malware can't be installed through USB on a Chromebook

FDE doesn't help if your machine is compromised while it's running and unlocked. The government has been known to replace links to Javascript libraries on unencrypted pages with malicious versions at the Great Firewall level. Browse with HTTPS only; there are plugins for this. VPN is also good, assuming you have one that actually works, and assuming it's not leaking DNS queries that get responded to with state-controlled IPs.

Being forced to unlock laptops at the border is largely a US thing. I haven't heard of anybody being forced to do it in China, but even so, what are your options besides refusal or compliance? Refusal will only end one way. FDE just makes it look like you have something to hide, and if in the end you're going to unlock it for them anyway, what was the point?

My opinion- don't bother with FDE. Just travel with clean images on your phone and laptop and assume both are compromised upon return. Change all your passwords and reimage your devices.


CSRF token for API serving application Currently, my architecture as follows.

API is served from api.domain.com.
Frontend application is served from frontend.domain.com.

I'm concidering two different methods for CSRF protection:

Letting the frontend acquire a CSRF token by making a request to api.domain.com/getCSRF after it loads the first time.
Enable CORS on my api.domain.com and allow request only from frontend.domain.com.

I found a major website using my first approach to get the CSRF token, but I don't think it's a good approach. Which one of my methods is better for CSRF protection?

You would need both:

Just #1 alone, without any CORS policy, would not allow the frontend to read the responses. And if you set a to generous CORS policy, it would allow  anyone included in it to CSRF you.
Just #2 alone would not offer CSRF protection. You do not need CORS permission to send normal non-preflighted requests, such as submitting an ordinary form. Attacks could still be mounted from any domain. CORS does not protect against CSRF because it's not designed to.

Together they work. The token ensures that only "non-forged" requests are allowed, and the CORS policy ensures that only the frontend can get it's hands on the token.

I should also mention that in situations like this, with an API serving a frontend, CSRF protection often comes "automatically" because a bearer token in the auth header (as opposed to a cookie) is used. So if that's your authentication scheme, you may already be protected. Implementing another layer of defence on that doesn't hurt, though.


Detecting Spoofed InDesign File Creation Date I apologize for turning here with a question, my research both searching here and on Google has only turned up useless information.

I believe that someone has sent me files that have had their file creation date altered via a program like the ones listed here.

Is there any way to detect spoofed file modification performed with utilities such as these?

Edit: The files in question were created using Adobe InDesign and "sent me some files" in this case is a USB thumb drive where the files were copied and sent to me.

Edit 2: In hopes of maybe culling one of two somewhat "duplicate" questions, I'll post here and assign a correct answer here if someone comes up with one. This is the much more complete context for where I am with this:

=====

I have an Adobe InDesign document with the following created action in <xmpMM:History>. There seems to be a discrepancy in the file, as <stEvt:softwareAgent> reports Adobe InDesign CC 14.0 which was released in November 2018, but the "created" action is timestamped 2017-04-03T16:16:19-04:00.

My question is this -- does this XMP tag <stEvt:softwareAgent> get overwritten such that it is normal to see this tag not match the version originally used to create the file?

         <xmpMM:History>
            <rdf:Seq>
               <rdf:li rdf:parseType="Resource">
                  <stEvt:action>created</stEvt:action>
                  <stEvt:instanceID>xmp.iid:da3ade9b-b298-4414-a7ad-8dc125eab74d</stEvt:instanceID>
                  <stEvt:when>2017-04-03T16:16:19-04:00</stEvt:when>
                  <stEvt:softwareAgent>Adobe InDesign CC 14.0 (Macintosh)</stEvt:softwareAgent>
               </rdf:li>

Systems that have been compromised cannot be trusted.  You can hope the attacker made a mistake, or missed something while they were wiping down their tracks, but in general, no, these aren't directly detectable.

First, identify your threat model.  In the kinds of organizations typically involved in data breaches, attackers often won't take the time to cover their tracks with precision timestamp tampering, because it's a lot of work to get perfectly correct.  Wiping their tracks gives them little benefit - once they whisk a copy of the data off to foreign soil, they no longer care about their tracks.  (While discovery time is improving, most breaches remained undetected for a month or more.)  In most cases they simply delete their logs, if they bother to do anything at all.  But I imagine a state sponsored attacker performing espionage would have more motive to operate stealthily to remain undetected for as long as possible.  So it helps to know your probable attacker.

There are things you can look for.  These could provide evidence of tampering, even though they can't be trusted to provide evidence of what really happened.

Look for inconsistencies in the timestamps.  The file's last modified datetime should not be earlier than the file's creation datetime, for example.
Look for file contents that are timestamped with values that don't match the last modified time of the file.  If the last line in a log file is stamped 2019-02-01 12:34:56, but the last modified time is 2018-04-20 16:20:00, that seems unlikely.
Look for other logs to corroborate program execution.  The Windows Event Logs may have audit history of processes that were run.  If it shows "2019-02-01 12:34:56 Accounting.exe terminated", and the Accounting.log file's last modified time is 2019-01-28 16:20:00, that would indicate the program was run but didn't log anything for the last few days, which might be unusual.
Look for multiple files that have no reason to be in sync that all have identical timestamps.  While I might expect tomcat-stderr.log and tomcat-stdout.log to have close timestamps, I might not expect them to have the same timestamp as accounting.log.
Check files that could contain unexpected timestamps.  For example, JPEG files can have metadata (called "EXIF") that can be viewed with an EXIF viewing tool.  Most phones and cameras will set the time the photograph was taken in the EXIF data.  If the last modified date of the image file is older than the date the photo was taken, it may have been tampered with.  Executable files may contain date artifacts from the linker; installation packages may have timestamps.
Look for evidence of hacker tools in the environment.  They may have run something like apt-get install nmap, which may be a clue as to when they performed their reconnaissance.
Check for logs on other systems the compromised system may have communicated with.  If the system is configured to export syslogs to a secure server, you would have a trustworthy source of when logins were made, applications were executed, etc.  External logging is a mandated requirement for certain security frameworks, such as PCI DSS, so it's not uncommon.
Look for gaps in logging.  If you see tomcat-stdout.2019-02-01.log, tomcat-stdout.2019-01-31.log, and tomcat-stdout.2019-01-28.log, you could reasonably wonder what happened to the logs from the 30th and 29th.

Keep in mind that any digital data could have been tampered with, and it could have been done so expertly.  Document what you find, but don't count on it to serve as proof in a courtroom.  If a system's been compromised, it's no longer trustworthy.


how to authenticate user in client-server implementation So I am trying to implement a client-server application for sending files over SSL sockets. And I am trying to decide on a very secure design for authenticating the client.

The server is going to have access to a database holding all the usernames and hashes for their passwords (so if the DB gets hacked the passwords are going to be "safe").

I am wondering if sending the password as a plain text that is then hashed at the server and compared with the hash on the database is the most secure option or not.

It sounds a bit insecure sending the clients password without any randomness in it but I don't see how else it could be implemented.

Any pointers would be much appreciated!

Passing the Hash
If you hash the password on the client, you run the risk of introducing a pass-the-hash (PTH) flaw. This is a real, surprisingly common phenomenon that significantly impacts the security of your application. It has been a key security issue in Windows for years: https://en.m.wikipedia.org/wiki/Pass_the_hash

(EDIT: the Windows example above talks about weaknesses in the NTLM challenge-response protocol. A well-designed challenge-response protocol should not be vulnerable to PTH, although these protocols have largely been superseded by transport layer security. See below.)

Essentially, if you hash the password first, the value that you are using to authenticate against the server is actually a hash of that password, and not the password itself. Therefore, an attacker only technically needs to know the hash, and not the password itself. As a result, if the database were compromised, you're now foobarred, because the attacker has all of the credentials they need.

Workaround
You could work around this by hashing on the client, and hashing that hash again on the server. This means that the database would contain a list of hashes that still need to be cracked before they are useful.

However, this doesn't particularly help your transport security dilemma. Whatever value you send to the server during authentication (the password or just a hash) is the value that an attacker can use to authenticate with against the server. Therefore, a client-side hash always has the same risk profile as the password itself. You're no safer by transferring it as a hash.

TLS
As a result, you're best focusing your attention on a good TLS configuration. Make sure that the client will never send sensitive information over a cleartext protocol, and that it only accepts valid server certificates. Consider certificate pinning if available. Configure support for only the most secure protocols and cipher suites on both the server and client.

Alternate authentication methods (all of which have the potential to be invulnerable to pass-the-hash if implemented correctly):

Public key authentication with client certificates (TLS)
Kerberos / SPNEGO
Challenge-response protocols such as HTTP Digest (not recommended). These involve hashing and salting and are therefore most similar to the client-side hashing under discussion. When implemented properly, they should not be vulnerable to PTH-style attacks.
Secure Remote Password (SRP)

Such protocols are largely unnecessary in modern applications due to the increased availability and interoperability of TLS.


Hanging on When Sending Stage I'm new to Metasploit. I set up a multi-handler exploit and also made an EXE file with meterpreter/reverse_tcp payload. Both 3rd party AV and Windows Defender are deactivated. But when the victim (my own Windows 10 machine) runs the EXE file, my Metasploit shell hangs on the sending stage. What do I do?

The problem was because of firewall blocking the communication between shell and the attacking machine. Disabling the firewall solved it.


Client initiated cookie Vs Server initiated cookie I'm finding similar comments and articles around client side cookies that they are initiated by client and store everything on the client side and server does not store anything. On the other hand server side cookie is set by the server. Server sends it to client that has a unique ID which client sends back with every request. Makes sense. Because this is how server identifies client and same session.

What I don't understand is client side cookie. If there is no ID involved and nothing is saved on the server, then what's the whole point of client sending that cookie to server with every request? And most of all how server identifies its the same client if it has 0 information to compare with and check. That means stateless.

It seems to be little confusion .

cookies are the Key/value pair send in response header by web server , and stored locally by your web client

Browser request example:

GET /index.html HTTP/1.1
Host: host.com

Example answer from the server:

HTTP/1.1 200 OK
Content-type: text/html
Set-Cookie: a=10
Set-Cookie: aa=20

By server side cookie you mean to say Session stored by Web Server, these are basically use to map your session with the cookies coming in the request header

so both have their respective roles for session to work properly


Blacklisting IP addresses -- when should we take action? I am responsible for securing an AWS environment and am noticing various recon attacks against the environment. We have the option of blocking the IP addresses in our firewall, but the environment is scanned with different attacks multiple times a week (i.e., management of this is not simple). This environment is mostly for B2B and does not host a great deal of traffic, so my thought would be that we should block away.

I would think for other environments that are very high in consumer traffic, blacklisting IPs may not be the best idea because, as we know, IP addresses can change frequently and be assigned to non-malicious users. We wouldn't want to block a potential customer from our website.

A follow up question would be, is it best practice to then remove these blacklisted IPs after some time in case they no longer are associated with an attacker?

In order to answer your timing question it's important to understand how blacklists really help you. Blacklists are a great way to slow-down attackers and work great when triggered appropriately. Even a 30-minute blacklist can really have a huge impact against any type of automated attack. There are tools like fail2ban (link below) which can easily help you automate your blacklisting based on malicious behavior. Likewise there are tools like ipset (link below) which can be used with iptables to create large black-lists or white-lists than can easily block or allow tens of thousands of IP's with almost no impact on performance.

But back to your question on timing. Every site will have different needs and different requirements but as a general rule of thumb I group who I blacklist into three categories.

1.) IP's that will never have a need to connect to these systems

2.) IP's that are doing really targeted harmful stuff to these systems

3.) IP's that are scanning or doing something less harmful but are still annoying and may include a customers infected system.

and based on these groups (yours may be different) I set a variety of different block times. In this example I use the following block times based on the groups above.

1.) Forever

2.) 24-168 hours

3.) 30-60 minutes with 30 minutes being the most common.

This said I would also take into context what activity you are blacklisting. If an organization has a public website but I see attacks brute-forcing secure-shell or a VPN server (something that is NOT meant to be accessible to the general public) I don't mind blocking that type activity for much longer on that port or protocol. Likewise if I see an IP address really hammering a site with tens of thousands of attacks or repeated activities for days that IP gets blocked for a longer time.

So in some sense there is no cure-all answer to your question but I do see lots of very large name-brand companies blocking for at least 30 minutes to disrupt the automated attacks and I highly recommend doing this because it gets rid of a lot of the brute-force scanning that ultimately effects all sites.

Note: With the #2 group it is also wise to send an abuse e-mail to the bad actors ISP CC'ing the IP owner and/or domain owner. Frequently this helps resolve the problem after a few days and if not you can always promote that IP to group #1 if you have too.

Finally I would also recommend creating a white-list of your infrastructure and also of your key business partners or critical clients. Occasionally business partners do check the security of their supply chain and you may not want to auto-block these organizations if they decide to take a closer look at what you are doing.

I think it is very wise to actively blacklist bad actors especially since it's a very cost-effective defense but I wouldn't limit your blocking to a single type & time-frame if you can avoid it. That said if you do, 30-minutes seems to be the industry norm right now.

http://www.fail2ban.org/

http://ipset.netfilter.org/

http://ipverse.net/ipblocks/data/countries/

Hope this helps.


Methods to identify strange behavior when virus scan fails? I'm not sure if it's relevant, but the computer in question is a DELL Optiplex 3040.

OS: Windows 10

Symptoms:

Chrome browser auto-opens tabs that is file:// browsing, like the documents folder.
Page will change by itself and the DVD drive opens

What I've Done:

Reset Chrome, checked start up pages, settings, etc.
Installed AVG, updated definitions, ran all tests. (Then uninstalled)
Installed Kaspersky, updated definitions, ran all tests. (Still installed)
Checked Firewall (Currently using Windows default security settings and defender)
Checked for suspicious apps running via task manager.
Checked for suspicious programs installed via Add/Remove Programs

Every test passed with flying colors. Is there a list of steps I can take for further action to identify the issue? I've never seen this before.

If I was you, I would just re-image it.

If you need to know what could be running, do a memory dump before you shut it off, and take a copy of the disk (using a live linux ISO and dd) for analysis.

Check any firewall logs you might have, and check for any strange outbound connections.

You don't mention you environment, but if you have domain admins, they could just be messing with you.

Updated:

A hack that had such 'obvious' symptoms wouldn't necessarily be as concerning as one that didn't (which is why I asked about your admins).

The real issue is that if you think you've lost control of your PC (and that does sound like it might be the case), then there is very little you can do to be sure you have addressed the issue, if you don't re-image.

An attacker with sufficiently high privileges can do a lot to mask and obfuscate their actions, and that ultimately means most of your diagnosis tools become less trustworthy: if you do see something, that's generally promising, but if you don't see anything suspicious, then you have no way of knowing what that means.

So, while I can understand you don't want to re-image, doing so is by and large the only way you can hope to have some peace of mind, and certainty about you system.

That doesn't mean you must or should do anything in particular - other than what you think is best.


Port Knocking is it a good idea? Normally for a server I like to lock down SSH and other non-public service to only be accessible by certain IP addresses. However this is not always practical if the business doesn’t have static IP addresses or if outside developers need access.

I heard about Port Knocking a while ago and have finally had chance to look into it as a solution to the above problem. As a result of this I have a load of questions I hope people can help me out with.

Has anyone deployed it within their Business / Organisation and can offer any advise?
What is the best knocking Daemon to run under Linux?
What are the best clients for Linux, Windows and OSX?
What is the recommend length for knock sequence and is it best to use TCP, UDP or Both?
What are the associated downsides and issues with using it?
Is it just Security Through Obscurity?
Are there any alternatives to the port knocking
approach?

While I have not deployed it yet, I know many people who have deployed it.  Every single one of them have noted a significant reduction in the amount of bandwidth consumed by things like SSH brute-force attacks as a result.

However, that is not to say that there are not downsides.  AFAIK, there are no kernel-based port knocking implementations available, which for me would be the real key to adoption.  Port knocking daemons rely on reading failed (and filtered/prohibited) log file entries from a firewall system.  That's all fine and dandy, but what happens if the filesystem gets full?  What happens when the daemon gets killed because of some runaway process eating up the system's RAM and swap?  What happens if something else which either of those two things depend on just up and stop working?  You most likely end up with a server that you will have to physically access.  That could wind up being more costly than is reasonable, especially if you are more than a few tens of miles away from the server and do not have anyone that you can call to get there in a hurry.

One thing that I can say is that it is not "security through obscurity".  Port knocking is a form of authentication, and like any authentication system it can be made to be as simple or complex as desired.  Something as simple as "knock on port 10,000 + realPortNumber" can be done, which would amount to a trivial break, or the port knocking might itself be used to transmit some form of real authentication (say, 1 block of AES encoded data given a key derived by some other method).  It would not be feasible to use port knocking to transmit large amounts of data, though, because it would take significantly longer than just sending a single packet, and if the packet is over TCP than at least it can be known if it was received successfully or encountered some form of error.

One interesting question that this brings up, however, is how to manage the log files---userland implementations mostly require the log files in order to determine whether or not a knock has been successfully sent, and what happens if those logs are leaked?  Authentication data becomes known, and that is obviously not a very good thing.

I cannot tell you whether or not to use port knocking in your setup.  I am not yet, and I am not 100% certain that I ever will be.  It makes more sense to me to use strong authentication systems that are based on strong cryptography (such as a PKI infrastructure) than it does to throw port knocking in the way.  Also, adding a single point of failure to access critical infrastructure, to me anyway, seems like a bad idea, and way more difficult to properly support with any sort of guarantee.  Again, though, that is based on the notion of the port-knocking software being not integrated with the firewall at the operating system kernel level; if that ever changes, I may also change how I feel about using it.


What precaustions should be taken when the file displayed by a webpage is specified by the GET value My website shows some files based on the get value in the URL. For example http://www.mysit.com/navigate.php?d=firstpage.html The thing is navigate.php knows which folder to look in and it's not in the web root directory. Are there any precautions I should take? For example what effect does . or .. have on a URL? If an attacker entered http://www.mysit.com/navigate.php?d=../topsecret could they gain unauthorized access?

You should be sure to put additional filtering on it to make sure it doesn't try things like that.  Personally, at a minimum, I would attempt to parse and reform the input and make sure that no operations like directory changes can occur.

A better option would be to store the filenames in a DB and pass in a simple token that could be used to look up the filename to use.  This could then be filtered for any input that doesn't fit what is needed for your tokens.  It also could allow your site to work without having to update the GET information unless you specifically want that for linking functionality.


Gmail and/or Flipkey-Tripadvisor account hacked, how to prevent in the future I have a FlipKey account (property rentals site) that has been hacked and I'm hoping to understand how it happened and what I should do to prevent it from happening again.

The hacker is able to get into the system even though the password has been changed. Tech support from Flipkey is not helpful and only say to change the email and provide few reasons to explain why it happened or how to prevent it in the future.

Furthermore, the hacker or bot still seems to be in the system sending one of those 'WhatsApp' worms. The same email is used for other property sites.

I've changed the password and email already.

The question is what could have caused this on FlipKey and how can I prevent this from happening in the future?

Step One: Attempt to secure you computer, if an attacker has compromised your computer they could be using key-logging software to capture your passwords or remotely control your session:

Run two virus and malware scans, from well know, trusted vendors.
Remove any unused software.
Remove any unused extensions or plugins from your browser.

Step Two: Ensure your gmail account is configured securely. Most password reset functionality trusts only you can access your email account. If someone has access to your email account they will be able to access most of your accounts.

Change the password
Set up two factor authentication on your account.
Check which application have what permissions to your google account via https://security.google.com/settings/security/permissions?pli=1

Step Three: If you have any Android devices associated with this gmail account, review which app's you have installed and what permissions these have. Remove any app that your don't use or has more permissions then it requires.

Step Four: Check your security settings in FlipKey, I don't know FlipKey so this are general advice:

If you can change the login provider to one of the big names do so. (logon with [Google, Facebook, Yahoo, etc].
Otherwise change your password, and if FlipKey provides two factor authentication enable this.
Have a look through your account page and see what other security features FlipKey provides.

If after this you still have an issue I would follow the advice of @AntoniusBloch and use a separate computer to change your passwords again and wipe your computer, and reinstall.


Is this a session fixation I really can't understand the session fixation attack.

I've read OWASP definition that said:

  Session Fixation is an attack that permits an attacker to hijack a valid user session. The attack explores a limitation in the way the web application manages the session ID, more specifically the vulnerable web application. When authenticating a user, it doesn’t assign a new session ID, making it possible to use an existent session ID. The attack consists of obtaining a valid session ID (e.g. by connecting to the application), inducing a user to authenticate himself with that session ID, and then hijacking the user-validated session by the knowledge of the used session ID. The attacker has to provide a legitimate Web application session ID and try to make the victim's browser use it.

At the same time, I read this report, and the security researcher says that this vulnerability is session fixation session fixation report:

  Summary:

  The application does not set a new Session ID in the cookie after what
  appears to be an authentication attempt by the user. If this was a
  successful login and the Session IDs are stored in cookies then this
  application is affected by Session Fixation vulnerability.

My question is: is the vulnerability in this report session fixation, and is the steps of testing this vulnerability the steps of testing session fixation?

The text that you quoted describes a session fixation problem. But the entire report (I included it below for reference) describes a problem with logout. Specifically, it says that logout only happens on the client side, not the server side. Per the OWASP Session Management Cheat Sheet's discussion of the logout button:

  the web application must invalidate the session at least on server side.

So, if correct, this is a vulnerability, just not session fixation. (I'm not sure if it has a name.)

The OWASP's guide for Testing for logout functionality describes how to test for this, but the report's instructions to reproduce, included below, also describe it.

Just to be extra sure, you may also wish to test for a session fixation vulnerability. Just follow a session fixation testing guide, such as this one from OWASP.

Vulnerability Report

bug-session fixation
Severity: Medium

Summary:

The application does not set a new Session ID in the cookie after what
appears to be an authentication attempt by the user. If this was a
successful login and the Session IDs are stored in cookies then this
application is affected by Session Fixation vulnerability.

To reproduce this vulnerability

1.open chrome and download edit this cookie ad-don
2.now open https://www.reddapi.com/ and log in
3.now go to edit this cookie addon and click export all cookies ...
  by clicking this we get the cookie copied in clipboard..
4.logout from your https://www.reddapi.com/ account...
5.if needed u can close and open your browser.
6.now again go to https://www.reddapi.com/ but don't login..just
  simply go to edit this cookie addon and click import a cookie
  and paste the code which we previously exported.
7.after pasting just refresh the page and that's done you are now
  logged into your account without login details...

problems faced

the problems face if the vulnerability exits are
1.anyone can easily hijack victims or users session and get into his account
2.cookie stealing is the best way the hacker can get into and account..
  it would not take more than 5min to steal someones cookie using php n all...
3.even friends can fool the victim and get him hacked..


How to view extension privileges in Firefox? In Google Chrome, I can go to chrome://extensions/ and click "permissions" to view the permissions that an installed extension has been granted.  I cannot find an equivalent in Firefox. Is there such a resource? In Firefox, about:permissions has per-site permissions, which is a great resource but I need per-extension permissions. (Firefox version = 23.0.1)

Read this document. Relevant excerpt (page 3):

  The Firefox platform has no mechanisms to restrict the privileges of add-ons. The add-on code is
  fully trusted by Firefox. The installation of malicious add-ons can result in full system
  compromise. There is no security measure to restrict the intercommunication between add-ons.
  As a result an add-on can alter or modify another add-on in the background. There is no security
  policy or sandboxing ability of XPConnect and XPCOM components which is a serious flaw in the
  security
  model. Firefox does not have any type of restrictions on malformed Cross Origin
  Resource Sharing and socket creation. Some exploitable vulnerabilities are platform
  independent.

So there is no way to show per add-on permissions because there are no permissions to show. In the Firefox security model, each add-on is roughly equivalent to a piece of native code, which can, by definition, do whatever it wants. This is similar to the situation with signed Java applets.


If a MiTM has server's cert, how can certificate pinning protect against this? In a scenario where client -> server through SSL, the server replies with the set of cert(chain-of-trust) which also contains the certificate pinned inside the client.

Let's say the Root CA is compromised and the setup is this : client -> MiTM -> server

Can't the MiTM just use the set of certs from the server to bypass certificate pinning? Does the pinned cert have to be the leaf-certificate in the chain?

If the private key of the pinned certificate or one of its descendants is compromised then certificate pinning can't help you.

If the leaf-certificate is pinned, only getting the private key of this certificate allows MitM. If the intermediate certificate one level above is pinned, getting the private key of this intermediate or the leaf allows MitM.

Of course, pinning the leaf also makes it a lot harder to change that certificate.

As always, there is a trade off.


Find hash-function if original and hash are given? I was thinking whether or not you can find the hash function(s) used if you have the original message and the hash. So assume that no salt is used during the hashing process, just multiple hashing and concatenation, e.g.

hash = SHA512(MD5(original) || SHA512(original))

So how could you find the right hashing process, if really no salt is used and the process does not depend on other things like system time etc.? Remember that the original and the hash are given. Is the only way to find the right hashing sequence brute force?

You can certainly narrow the possibilities down by just looking at the hash. MD5 spits out 128 bits and SHA-256, 256 bits. Beyond that, it would have to be brute force.


SSL Server Allows Anonymous Authentication Vulnerability We have several Windows 2008 and 2012 servers which are showing the, "SSL Server Allows Anonymous Authentication Vulnerability"

What is the best way to remediate this vulnerability without affecting clients.

Thanks.

The issue of Anonymous Authentication in SSL means that the server is accepting ciphers which don't require authentication of the server. This authentication is usually done by checking the servers certificate. Using a cipher with anonymous authentication means that no authentication of the server will be done inside the TLS handshake and thus the connection is open for man in the middle attacks.

It is unknown which kind of clients you have. But if you have just browsers as clients then you could simply disable anonymous authentication in the server since browsers don't use these ciphers anyway.

For any other clients you would actually have a look at the specific client and if it uses anonymous authentication. But most clients will also not use anonymous authentication by default so the chances are high that no client will be affected when switching these insecure ciphers off.


Poodle - possible to protocol downgrade if SSLv3 is disabled but still have SSLv3 ciphers enabled? My title pretty much sums it up. If I have:

A server with the SSLv3 protocol disabled BUT still have SSLv3 ciphers enabled.

Would that mean that a protocol downgrade attack can still occur?

If your server does not support SSLv3, then it does not support SSLv3. "Protocol downgrade attacks" are methods to force a client and server to use a protocol version that they both support even though they both know at least one newer version that they would have wished to use, given the choice.

Anecdote: I am French. Back in 2005, I was walking in the streets of New York (5th avenue, I think); I was there for a congress. A few paces ahead of me, I see two tourists speaking together, and they speak in French. Two minutes and three blocks later, one of them notices me, and (crucially) that I was handling a map. So he resolves to ask me a question because they were a bit lost. He then talks to me in English. That's understandable: in New York, English is the "basic language". That guy knew two versions of the protocol (the English one and the French one) and obviously preferred the French one (since that was what he was using with his wife). Fortunately, I leveraged my previous knowledge (that he knew French) and we continued the conversation in French.

So that's it. A protocol downgrade attack is when you arrange for two French people to speak in English by preventing them from realizing that they both know French. However, that can happen only because they both agree to speak English. If one of them disables the "English" protocol (because he refuses to speak English, or simply does not know it, or knows only the utterly unintelligible Texan-accent variant of English), then of course they won't speak English at all, attack or no attack.


Can string comparison realistically be exploited in a timing attack on a web server? Suppose you have the following code in Node:

const { token } = req.body
const hash = crypto.createHmac('sha256', SECRET).update(token).digest('hex')
const user = await User.findById(req.session.userId)

if (hash === user.rememberMeHash) {/*...*/}

The string comparison above is deemed vulnerable to a timing attack because it can leak the character position on a mismatch, so the correct way is

// Hashes are already equal in length because the same hash function was used
if (crypto.timingSafeEqual(new Buffer(hash), new Buffer(user.rememberMeHash))

While true in principle, I can't see how this leak is practically possible. To get reliable time measurements, you'd need to

isolate the code snippet to avoid interference from side effects (request handling, Express routing, DB queries);
run a large number of empirical tests in a strictly identical environment (same CPU & memory usage, processes, OS);
have access to a local server instance that has no traffic or intervention from outside.

None of these are realistic in a distributed system, much less to an attacker with no privileged access and no knowledge of the specific hashing algorithms and secret keys employed.

In practice, you will necessarily get varying and inconsistent results when timing any code, particularly one that is just-in-time compiled like JavaScript. This is well understood in algorithm analysis which doesn't directly measure algorithm runtime because these measurements are acutely sensitive to the underlying hardware, software, compiler, language, etc. In this particular case, compared to a database query or a network call (or even script processing when running node binary on a .js file), string comparison takes a minuscule amount of CPU time to process.

Now, also consider that the above code runs across a cluster of servers behind a load balancer. As such, HTTP response times will vary depending on other incoming and ongoing requests (i.e. website traffic), background processes, hosting provider uptime, network fluctuations (e.g. speed drops), use of Tor or a VPN, and hundreds of other factors.

Considering a real-world web server architecture, how can a mere string comparison ever be exploited in a timing attack?

Timing attacks are possible even if response times seem inconsistent, because you can use statistical analysis to filter out a lot of noise in the data. Average values are much more stable than instantaneous values, for example. A fixed delay (like the one introduced by the comparison) will be added to the average, while inconsistent delays (like the ones introduced by the network) will cancel out. Example:

Response times: 17, 20, 1, 15, 62, 35
Average: 25

Response times (+1 delay): 18, 21, 2, 16, 63, 36
Average: 26

So as you can see the fixed delay is detectable in the average value, and instantaneous spikes don't matter. Finding a stable average value might be difficult though, and it might require a lot of attempts (thousands or even millions of requests). Also the average value might not even be stable enough, and other statistical analysis might be taken into account.

This complexity makes remote timing-attacks impractical in many situations, although research has shown that they are possible within local networks. This means that an attacker might well try to use such timing-attacks once they have broken into your local network, for example. On the other hand, it might be impossible to use the same attack from a remote location, or it might not be worth it at all anyway, depending on several factors like the configuration of the network and your server. A remote attacker will therefore focus on other vulnerabilities to exploit. Also remember that you can avoid this problem by implementing some kind of rate-limiting in your server, banning any potential attacker after too many attempts.


PCI-DSS compliance in scope if part of card number and expiry stored only? If we were to store the following information about a credit card, would we need to be PCI-DSS compliance or are we out of scope? Please assume for the purposes of this question that we only store this information and don't actually process any credit card payments at all.

Card BIN (first 6 digits)
Card last 4 digits
Expiry date

IANAQSA!  That data doesn't put you in scope, but you're probably in scope anyway, but dint of whatever relationship you're in that gets you access to that non-scoped data.

To quote PCI-DSS 3.2 (emphasis as per source):

  The primary account number is the defining factor for cardholder data. If cardholder name, service code, and/or expiration date are
  stored, processed or transmitted with the PAN, or are otherwise
  present in the cardholder data environment (CDE), they must be
  protected in accordance with applicable PCI DSS requirements.

If you never have the full Primary Account Number, then you do not have cardholder data.  That is not to say that you're not subject to the DSS, however.  Even a merchant who outsources all handling of their card data to their service provider is subject to something like the SAQ A (Self Assessment Questionnaire).

What you're describing (first 6, last 4) is called Truncation and is described in section 3.4 of the DSS.  So someone - your service provider? - is truncating card numbers and handing those to you in lieu of card numbers.  If that's the case, your service provider should be authoritative for helping you figure out what your scope is under the DSS.

It comes down to this:

  PCI DSS applies to all entities involved in payment card
  processing—including merchants, processors, acquirers, issuers, and
  service providers.

Do those truncated numbers put you in scope?  No.  If you're receiving truncated numbers, are you likely in a relationship that makes you subject to the PCI DSS as above?  Very likely, yes.


Help with creating Heartbleed vulnerable server I am using Virtualbox internal network with Kali Linux and Ubuntu 12.04. The version of OpenSSL for the Ubuntu is 1.0.1 which should be vulnerable. I have created a HTTPS server using nginx on the Ubuntu and when i scan with nmap on the Kali Linux it shows that port 80 for http and port 443 for https is open. However, when i use the heartbleed exploit on Metasploit in Kali and run the check command it says:

[*] 192.168.1.70:443 The target is not exploitable
[*] Checked 1 of 1 hosts (100% complete)

Running nmap with

nmap -d –script ssl-heartbleed –script-args vulns.showall -sV 192.168.1.70

also does not give me anything.

How do I create a heartbleed-vulnerable server? I dont mind trying out another method as long as it works. The method here was done following https://warroom.securestate.com/building-a-vulnerable-box-heartbleed/

Unless you are using a version of 12.04 which was unpatched for years the OpenSSL on your test server is not vulnerable even if the OpenSSL version number shows a vulnerable version. Vendors backport security fixes in the OpenSSL versions they ship and thus the version number itself does not say a lot. See Why is this version of OpenSSL (1.0.1e) not vulnerable to Heartbleed?
.

Thus if you would like to setup a vulnerable system either get old and unpatched images or get the vulnerable version from openssl.org and compile it yourself and also make sure that all applications you want to test are linked with this vulnerable version.


Can my employer see my Google Search Data on my personal IOS device when I’m at home but accidentally logged into company Google Account? I was browsing the web at home using Safari on my IOS device (mainly Google search). I happened to scroll to the very bottom of the screen and realized Google was logged into my Google account for work. It has probably been like that for a very long time, but I am wondering whether or not my employer can see all the things I’ve searched for on Google while on my phone at home.

It doesn't matter what Internet connection you use or what device you use, the fact that you are using the company's account means that they could review all your activity on that account.


How to protect from copying files? Is possible to protect files from being copied if you are the administrator of a machine? I heard that this behaviour is possible: one software developer sells his software in such a way. He installs it on every client's computer to prevent the software from working on other computers or to prevent it from being physically copied. How can this type of copy-protection be implemented? Is it cost-effective to implement if the software only costs about $100 for all copies to be deployed across the client's company?

This is not a problem that cryptography can solve.  This is problem that can only be addressed with the Operating System's Access Control by removing read privileges to the file.

Or put another way,  DRM is a fundamentally flawed approach,  and will never work.


Is OATH TOTP and / or Google Authenticator vulnerable if an attacker has (N) previous codes? I'm not much of a ipsec initiate, so this is a bit over my head ... but I'm always willing to learn more.

Are there any known attacks against OATH TOTP (Google Authenticator's / Authy's algorithm) if an attacker has an (unspecified) number of previous one-time passwords, as generated by the app?

Or, to put it another way: is there any reason to worry about there being a record of individual OTPs that I have used in the past? (For example, can I enter them at the command-line when invoking a tool … or should they be entered like passwords, silently and interactively, to avoid them being recorded?)

The TOTP specification points, for the security analysis, to HOTP. HOTP uses a counter, shared by both parties, and "resynchronized" every time a successful authentication occurs; TOTP replaces that counter with knowledge of the current time, which is also a shared value. As such, almost all the security analysis of HOTP applies to TOTP.

The security analysis of HOTP uses the formal tools and notations of cryptography, but boils down to the following assumption:

Let T denotes the time to perform one computation of H.  Then if A is
any adversary with running time at most t and making at most p oracle
queries,

                   Adv(A) <= (t/T)/2^k + p^2/2^n

In practice, this assumption means that H is very secure as PRF.

The important word here is PRF: it means that the "H" function (HMAC/SHA-1) behaves, in the view of the attacker (who does not know the key) like a function chosen "at random" among all possible functions. We give the attacker access to an "oracle", which is a machine which knows the key, and computes HMAC/SHA-1 over inputs chosen by the attacker; the attacker can send p such queries. The expression above means that even under these conditions, the probability that the attacker successfully predicts, after all his queries, the output for one extra input (that he did not send to the oracle), is still very low (the "advantage" is what extra success probability the attacker has over pure luck).

Right now, it seems that HMAC/SHA-1 behaves as a PRF. Nobody has found any indication to the contrary. This holds even in the face of the known structural weaknesses which seem to allow (theoretically) some computing SHA-1 collisions.

From this assumption, the security proof of HOTP (as exposed in RFC 4226) establishes the following result:

Suppose m = 10^Digit < 2^31, and let (q,r) = IntDiv(2^31,m).  Let B
be any adversary attacking HOTP using v verification oracle queries,
a <= 2^c - s authenticator oracle queries, and running time t.  Let T
denote the time to perform one computation of H.  If Assumption 1 is
true, then

     Adv(B) <= sv * (q + 1)/2^31 + (t/T)/2^k + ((sv + a)^2)/2^n

In practice, the (t/T)2^-k + ((sv + a)^2)2^-n term is much smaller
than the sv(q + 1)/2^n term, so that the above says that for all
practical purposes the success rate of an adversary attacking HOTP is
sv(q + 1)/2^n, just as for HOTP-IDEAL, meaning the HOTP algorithm is
in practice essentially as good as its idealized counterpart.

This last paragraph is what you are after: under the assumption that HMAC/SHA-1 is a PRF, it is proven that giving access to a lot of previous one-time passwords does not given any advantage to the attacker for guessing the next one, at least no more that what he would get out of an "ideal" version of HOTP in which the one-time passwords are obtained through pure unpredictable magic.

Summary: No need to worry. Resistance of HOTP (and TOTP) to the situation where many previous one-time passwords have been recorded is part of the security model of HOTP, and it has been specifically shielded against such an occurrence. The shield here relies on an assumption of security on HMAC/SHA-1, which, while not proven, is about as good as these things can get (notably because it is quite possible that the fact that a function family is a PRF might be mathematically impossible to prove; see this for more on that subject).


When to use which rootkit? According to my understanding so far:

a kernel-space rootkits runs in ring0 and use techniques such as syscalls
a user-space rootkits runs in ring3 and uses techniques such as library injections
rootkits are all executed with administrative privileges. Hence, an attacker would have obtain the necessary information available to run the rootkit

However, I am confused at when would one would prefer to use a kernel-space rootkit or a user-space rootkit. As a kernel-space rootkit has higher privileges why not just run a kernel-space rootkit every time?

You might not have high privileges on the system you're targeting. If you don't have ring 0 or equivalent privileges that allows you to modify the kernel (e.g. by loading custom unsigned kernel modules when supported), you might have to limit yourself to a userspace rootkit. Just because you have root doesn't mean you can get ring 0, and many secure configurations prevent root from modifying the kernel.

Another reason you might prefer a userspace rootkit is because it is less likely to crash or malfunction. A kernel rootkit will typically only work with one specific kernel version, and any update to the kernel requires adjusting the rootkit. Furthermore, a kernel rootkit is more likely to cause instability and bring the entire system down. If you don't need the powerful features a kernel rootkit can give you like syscall hooking, you might choose the option which is more stable and works on a wider variety of systems.

A well-designed userspace rootkit might work equally well on Debian Linux as on Solaris (a UNIX which has no code in common with Linux systems), but a kernel rootkit designed for Debian with kernel 4.18.6 might not even load if you try to run on CentOS, even if the kernel version is the exact same.


Security implications of WAF revealing internal IP addresses What are the security implications of a web app firewall/load balancer revealing internal IPs of the web sites behind it to the outside world?

A specific example is with F5 products: They use a cookie that can be decoded to show the internal IPs of the sites they are serving up. Google for BigIP cookie decoder if you want to learn more. (Note: you CAN enable encryption of the cookies if you want to hide the internal IPs.)

I get that learning the internal IPs would be part of information gathering but the scenarios where it would be useful seems limited. An attacker could use it with social engineering to target specific machines. Besides that, what attack surface or attack vectors are opened by leaking the internal IPs of websites?

What are the security implications of a web app firewall/load balancer
  revealing internal IPs of the web sites behind it to the outside
  world?

If when you say, "internal IPs" you mean the web server's LAN address (i.e. same datacenter, private networking, etc.), then you have a scenario similar to WebRTC revealing your computer's private IP address.

The greater risk is if when you say, "internal IPs," you mean remotely-accessible (i.e public facing) IP addresses that we just don't talk about and rely on security by obscurity for to conceal and protect. In this case, the attack surface here is your entire web server as it is directly accessible from the Internet, and simply learning its IP address would allow an attacker to completely bypass your web application firewall and any blocking & logging it might have.

For defense in-depth, you might consider the following access controls:

Creating firewall rules on the web server to only allow inbound traffic FROM your load balancer, precluding direct access from any other network/IP, even if it was leaked.
Removing the server's public IP, and only use private networking

Of course, this implies a balance in security vs. maintainability. I would imagine you will still need a way to remote-in (i.e. VPN, SSH, or possibly via infrastructure management software like Chef, Puppet, continuous integration process, etc.) but the point is that you would do so under tighter access control that would render knowledge of your server's IP mostly useless.


How to implement zero trust concept on a pod running in Kubernetes? Was thinking to use Ambassador design pattern and filter each request through Nginx with Waf (mod_security or Naxsi) in reverse proxy and ACL, authentication and authorization to pod.
What are the best practices?
How to prevent "soft belly" of each microservice being open in the network (vlan, vpc or similar)
Thanks,

If you're looking to harden a Kubernetes cluster for east-west traffic, then you can generally use the Kubernetes Network Policy API.  This will allow you to restrict traffic to specific white-listed sources and destinations based on Kubernetes labelling and/or CIDR ranges.
In addition to base functionality provided by k8s, you can supplement this with additional policy options based on the CNI provider you're using. For example both Cilium and Calico, support the creation of global network policies to allow for the establishment of baseline security in the cluster network.


How choose a k for k-anonymity? I have manually scraped multiple pages of search results on Google and haven't found a single suggestion as to how to find an optimal k when you are trying to "k-anonymize" your dataset. All I can find is the obvious fact that "higher k = more security but more loss of information", but not a single idea is given as to how to tackle this problem.
Shouldn't a k of 2 suffice (as long as an l-diversity of at least l=2 is given)? Or should we go as high as 15, 20, 30, 100? I am fairly new to this topic and online materials offer no intuition whatsoever.
Do you know of any publicly available guidelines by organizations/companies/universities which discuss what value k to choose? Or any other resource?

The appropriate privacy level is entirely context dependent. Clearly k=1 and k=n are generally useless (for a data set of size n). One provides no anonymity, the other does not retain any utility (other than about very basic info like the size of the data set). But there could be interesting values in between.
In this anonymity vs utility tradeoff, an appropriate privacy level can be bounded from either direction:

given a certain analysis that should remain possible with the anonymized data set, what is the maximum k we can tolerate?

given the privacy guarantees we'd like to make, what is the minimum k we require?

For example, lets consider the k-anonymity model implemented by the “Have I Been Pwned?” API. To check whether your password is compromised, you can send a truncated password hash and get back a list of full hashes of compromised passwords. The number of compromised passwords per prefix corresponds to the privacy level k in a k-anonymity model.
Here, an upper bound on k is given through the size of the list of hashes returned in a response. This list should be as small as possible to keep the API efficient. A reasonable upper bound would be somewhere in the kilobyte range, indicating k<2000. A lower bound is given through privacy/security requirements. Given a known-compromised password, neither the API nor any eavesdropper should be able to reliably determine for which compromised password the truncated hash had been sent. There is no clear safe lower bound since any query necessarily leaks some information. However, k<10 is clearly unsafe, and k<100 might still allow a malicious API provider to guess the true password with a reasonably good probability. This leaves a range of 100 ≤ k ≤ 2000 that could be appropriate for this use case.
In reality, HIPB uses a level of k≈500 [1, 2], though with additional padding to prevent further information leaks.
This is a very high k-anonymity level, motivated by the quite severe security impact of leaking passwords. In other contexts, a far lower k will be appropriate. E.g. basic demographic data is far less sensitive, and would likely have an appropriate level around 5 ≤ k ≤ 20. In many domains, a low k is implicitly required due to small size of available data sets – with the only reasonable alternative being to not disclose too sensitive data at all.
It should be noted that k-anonymity and related methods alone do not achieve very strong privacy guarantees at any k, and that the required redaction or abstraction of data is detrimental to many uses. In some scenarios, a probabilistic approach as in differential privacy can be more appropriate.


Is compiling source code from github a big security risk? I have several programs (Emacs el-get, oh-my-zsh and Homebrew) that occasionally load source code from github and compile it on my machine. Is this a big security concern? What can I do to prevent malware getting on my machine this way?

I'm going to assume you mean that you are compiling (but not running) untrusted code which could be malicious and are concerned about your build toolchain being exploited.

The answer is that, no, I don't think this is a good idea. Compilers are, in general, not safe to use with untrusted input.

Firstly, there's the source code itself. You don't mention what language you're importing from github, but if if it C/C++ (for example), then you may be subject to an attack from the preprocessor. While I don't know for sure that this is possible, I see no reason why it should not be. Having said this, however, there are online "compiler as a service" sites which will compile arbitrary code - so perhaps it is (or can be made) safe.

There are bigger worries than the compiler, though, since arbitrary filetypes can come down via github. For example, there's nothing stopping the a malicious Makefile from doing nasty things, which is very definitely possible, or a Visual Studio project specifying malicious "pre-build" script.

On the topic of Visual Studio (I guess you're using a make/gcc toolchain, but I'll mention VS for completeness - and because I know the answer) you should know that MS states that even loading malicious debugging symbols is a security risk, and that the visual studio linker is not considered secure against malicious code. A quick google finds this advisory which does not mention any patch is available.

Having said all of this, I haven't heard of this happening before, so it depends on your risk tolerance I guess. I wouldn't do it. If this is an automated build, it might be possible to build in a throwaway user account (taking additional steps if your source is intended to be kept secret).


Port Knock logs suggest machine has been compromised? On my CentOS machine, all my ports are filtered with the Iptables rule:

DROP       all  --  *      *       0.0.0.0/0            0.0.0.0/0

So from the Internet, every port timeouts.

The only way to ssh into the machine, is to do a Port Knock sequence as follow:

6        x   x LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:example 53853 recent: SET name: KNOCK1 side: source mask: 255.255.255.255 limit: avg 5/min burst 5 LOG flags 0 level 7 prefix "ssh port knocking 1 "
7        x   x LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:example 6663 recent: CHECK seconds: 15 name: KNOCK1 side: source mask: 255.255.255.255 recent: SET name: KNOCK2 side: source mask: 255.255.255.255 limit: avg 5/min burst 5 LOG flags 0 level 6 prefix "ssh port knocking 2 "
8        x   x LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:example 96563 recent: CHECK seconds: 15 name: KNOCK2 side: source mask: 255.255.255.255 recent: SET name: KNOCK3 side: source mask: 255.255.255.255 limit: avg 5/min burst 5 LOG flags 0 level 6 prefix "ssh port knocking 3 "
9        x   x LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:example 77799 recent: CHECK seconds: 15 name: KNOCK3 side: source mask: 255.255.255.255 recent: SET name: KNOCK4 side: source mask: 255.255.255.255 limit: avg 5/min burst 5 LOG flags 0 level 6 prefix "ssh port knocking 4 "
10       x   x LOG        tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:example 12263 recent: CHECK seconds: 15 name: KNOCK4 side: source mask: 255.255.255.255 recent: SET name: OPEN_SESAME side: source mask: 255.255.255.255 limit: avg 5/min burst 5 LOG flags 0 level 6 prefix "ssh port knocking 5 "
11       x   x ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            tcp dpt:example SSH REAL PORT state NEW,RELATED,ESTABLISHED recent: CHECK seconds: 15 name: OPEN_SESAME side: source mask: 255.255.255.255
12       x   x ACCEPT     all  --  *      *       0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED

Now checking at the logs, everytime I change the port sequence, I find in journalctl log that an attempt to those specific example port knock 1, knock 2...etc has been made.

kernel: ssh port knocking 1 IN=eth0 OUT= MAC=example MAC SRC=Attacker IP, always the same DST=My IP LEN=60 TOS=0x00 PREC=0x00 TTL=48 ID=xxxx DF PROTO=TCP SPT=source DPT=**ANY SEQUENCE I CHOOSE** WINDOW=29200 RES=0x00 SYN

There are no logs for any other port, nor any other probe whatsoever.

It's as if the attacker knows the sequence every time I change it.

Since there is absolutely no other log for any other attempt, and monitoring tcpdump shows no probes being done, is it safe to assume the attacker knows the sequence because the machine is compromised and he gets the information everytime I change it?

Your port knocking idea basically works by advancing from one port knocking stage to the next whenever the same client IP sends a TCP packet to the secret port of the new stage within 15 seconds of moving into the last stage.

Note that there is no penalty for wrong guesses and there is no rate limiting for guesses (the limit of avg 5/min only applies to correct guesses). This means all an attacker has to do in order to advance from one stage to the next is to scan all ports on your machine within 15 seconds, a task which can be easily achieved when using raw sockets (i.e. not waiting for the TCP handshake to complete).

  is it safe to assume the attacker knows the sequence because the machine is compromised and he gets the information everytime I change it?

Based on the information you've provided so far, one cannot claim this. I suggest that you look for failed or successful authentication attempts from this specific IP address to see if somebody actually tried to login (and maybe succeeded) instead of only doing port scanning and just accidentally triggered your port knocking rules. Also note that if the machine is really and deeply compromised you should not trust your local logs since the attacker might have changed these.

Apart from that:

  There are no logs for any other port, nor any other probe whatsoever

Based on the rules you show you log only if the port matches, i.e. there are no other logs expected.


How to exploit RSA and DHE export? I'm a white-hat beginner and I found two sites on Censys which have DHE and RSA exports. How can I show that these sites are not secure and are vulnerable to attack?

I wouldn't go ahead and so much as "show," but rather inform. Find the contact information for their System Administrator and/or security team, and inform them of what you've found, and how you believe it could be used as a vulnerability.

"Doing" anything to "show" a vulnerability, i.e. hacking, regardless of intentions good or bad, is still considered illegal without consent from the individual or organization.