Is it safe to buy smart home products from second hand? I wonder if it is safe to buy a smart home product (e.g. Eve Thermo). Because the code on the device, which is needed for pairing, is not changeable. Is it possible that the first owner is still able to control the device?

I'll answer the information security part of your question, i.e. whether it is safe to buy smart home products from second hand. Regarding the second part, I admit I have no idea whether Eve Thermo could be reprogrammed properly, but this might be worth asking directly the manufacturer.

Short answer: you're taking more risk buying a used product versus buying new directly from manufacturer. Depending how much money you save, this extra risk might or might not worth the reward.

Long answer: it depends on your definition of safety, but generally this is bad idea if you're concerned about security. Any "smart home" product which had been into skilled hands may be tampered with, and it may be difficult or impossible uncover such tampering. Here is my Youtube video where I show how a regular keypad electronic lock (not even a "smart" one) can be hijacked, so then it could be opened without typing in a code. Note that there are no visible changes on the lock itself.  This is much easier with "smart" devices which you're going to connect to your network anyway.

The risk of course is lower with Eve Thermo type of devices, but still exists.


Can i compare linux user permissions without root access? I've compromised two Linux user accounts on a RHEL machine (neither of which have root permissions) and I want to determine which account is more 'useful' to me in terms of access and privileges. Is there any way I can quickly and easily compare permissions/access between those two accounts?

Run sudo -l as a user to see what supplementary privileges that user may gain by running sudo. You'll have to know or collect the user's password to make use of these privileges, unless one of the sudoers rules is tagged NOPASSWD.

Run id to see what groups the user belongs to. You may then want to look around to see what these groups are worth.

These two are common ways to escalate access and easy to compare. Here are a few more areas you can look at with more work needed to get useful results.

Look around to see what files the user may access. Permissions can be granted via access control lists, not just ownership and group membership. The following commands list files that are respectively readable, writable and executable by the user but not by all users. The first two exclude the user's home directory (where it's unsurprising to have files that others can't access), and the third only targets setuid/setgid executables. These commands run on the root filesystem only, add more paths if there are more mounted filesystems (or remove -xdev and exclude /proc and perhaps /sys instead).

find -xdev / -path ~ -prune -o -readable ! -perm -a+r
find -xdev / -path ~ -prune -o -writable
find -xdev / -perm /u+s,g+s -executable ! -perm -a+x

Check the user's log and configuration files to see what kind of administration-related things they've been doing: shell commands in ~/.bash_history (or other files depending on the user's choice of shell and configuration), aliases in ~/.bashrc (likewise, or other files), scripts in ~/bin, …

Check if the user has SSH keys (in ~/.ssh/) that you may use to escalate your access to other machines (or occasionally to other accounts on the same machine). You may be able to see what sites the user has logged into by checking ~/.ssh/known_hosts, but by default the addresses are hashed so you can only verify guesses.

If this is a desktop machine, check for a running password manager. You're unlikely to find one on a server, but there instead check for an existing SSH connection that you may be able to piggyback onto (e.g. via X11 forwarding).

Emails may also give a clue. Check who administrative emails are forwarded to (/etc/aliases) and who has a local mailbox in /var/mail or /var/spool/mail.


Embedding malicious code into an exe How does malware usually embed into / infect exe files? (As in actually modifying the file on disk, not in memory). I've read it may look for gaps in the code section, insert its code, then redirect or change the entry point to that location. That makes sense, but what if there are no gaps large enough?
Specifically, would it be possible to insert bytes at the end of the code section, push everything else back, adjust the PE header/section sizes, then change the entry point to the new bytes? Or does something prevent this?

There are an enormous number of options. In no particular order:

You can enlarge the file, adding the malicious code and either making it the main entry point or adding a call to it from the existing entry point.
You can remove part of the file and replace it with your own code, if there's something you expect isn't needed (this is easier if you know the file in question).
You can replace a random chunk of the file that probably isn't needed for the program to launch and hope nobody notices in time.
You can scan all the libraries loaded by programs for insertion points for any of these techniques (including your original gaps) and infect those (hits lots of programs at once if you can do it to a shared library).
You can replace the file wholesale with one that has the same name and icon and is padded out to the same length but doesn't "work" at all.
You can replace the file but move the replaced code into its own boring-looking file that you execute in the foreground as soon as the replaced program starts, hiding the behavior.
You can edit the imports for the file to load a planted library that contains the malicious code (and optionally also calls the real library to do the expected thing).

...
Hopefully you get the idea. The difficulty is not in modifying the file, or even in hiding that you did so from casual observation. The difficulty is first getting code execution / file writing with sufficient privileges to modify executables at all, and second in preventing trivial detection and removal by AV software. That's a lot of why modern malware rarely does the classic "virus" thing you're talking about: it's too easy to write a signature for it, and remove it, once somebody knows to look. It doesn't have to be trivial, of course, and the better ones aren't, but it's usually not worth the effort.


Does an end user (or CA) certificate have any "fingerprinting" to indicate the brand of PKI being used? As part of my forensics, I want to determine if a given certificate has any indicator of which PKI software was used to create it.

So far, I see differences in the following properties for a Certificate Authority:

Serial Number (format, length, is ( not) random)
Issuer value (may align with internal AD forest name in MSFT)
Presence of "Certificate Template Information" (MSFT)
CRL Distribution Point contains a server name
Subject contains "DC = " (MSFT) versus other properties such as O, C present in Google.com

I'm sure there are comparable differences in end entity certificates, and CRL/CRL Dif certificates.

Question

Is there any resource that investigates the differences between the certificate output from various CA's  (or makecert.exe for that matter)?
Is there any byte level fingerprinting within a certificate? (or is everything exposed via a certificate export?

Not a direct answer, but maybe hints in the right direction
Cert linters
These might be interesting to spot anomalies: There is Peter Bowen's certlint (written in Ruby) and Kurt Roeckx's x509lint. Both of these are integrated into crt.sh. Here are some examples with interesting anomalies: cert for *.gmaptiles.co.kr and example.com
Also there is another certlint: GlobalSign's certlint (written in Go). I haven't tried that.
Pubkey generator identification
Also: There is some research on how to detect the library used to generate RSA pubkeys: From Usenix Sec 2016: The Million-Key Question—Investigating the Origins of RSA Public Keys (Archived here.)


How does drive by downloads work, and what does a browser being "secure" actually mean? In the last few days I have been researching all the types of viruses and also about the ways of infection. I have also read about the drive by method and my questions are:

How is it still possible that the attacker can execute code in browser and make the user download an infected file without his knowledge?
What are the facts when calling a browser secure? All the browsers like Mozilla, Chrome and Opera call themself secure but none of them are "bulletproof".

How is it still possible that the attacker can execute code in browser and make the user download an infected file without his knowledge?

In Google Chrome, files are downloaded into the Downloads directory without the user being prompted, so long as the file extension is not on a certain blacklist of known unsafe file types.

For potentially dangerous file types, the user must approve the download and/or opening of the file. There have been attempts to thwart this via click-jacking. Modern browsers such as Chrome and Firefox have a built-in delay to prevent this.

Some users can still be fooled though.

  What are the facts when calling a browser secure? all the browsers like mozilla chrome opera call itself secure but none of them are "bulletproof"

The term "bulletproof" is very vague.

In modern browsers, much effort has been applied to fix any vulnerabilities that would allow direct hacking out of the browser's built-in sandbox. It is important you keep your browser up to date to take advantage of these protections. Once you do that, the difference in security of the major browsers gets pretty small.

Even with no 'vulnerabilities' per se, the 'security' of various browsers may not be equal. Also it is highly subjective. There are many complex and edge case features various browser vendors can implement to protect your security.

For example, if a website asks for access to your Microphone and Video, both Firefox and Chrome ask for approval, but Chrome also requires that the website offers HTTPS encryption. Firefox does not have that requirement. (yet) That is not really a security issue in Firefox, nor a bullet-proofing of Chrome, but does make a difference in certain situations, such as public WiFi usage.
Some browsers do not yet support Content Security Policy. However, CSP is only a feature to help developers mitigate their own vulnerabilities.

All of these are very minor differences in the security of a browser.

I have a personal opinion that IE is one of the less secure browsers.

Again, always keep your browser up to date to take advantage of any new security features they have introduced.


Is there a way to identify the host of a malicious VM from across the network? Scenario:

Someone is attacking your network.  However, they're not exactly using their machine to do it - they're using a VM running on their system.  The VM's network adapter is configured in "bridged mode" so that the VM gets its own IP address, and effectively functions on the network as a separate machine from the host system.

Questions:

Without physically walking up to the attacker's system, and only using information available across the network, are there ways to determine:

That the attacker is using a VM at all?
Which machine on the network is the host system?

You don't say why you would care whether the attacker is using a VM.  I'd say it is irrelevant.  It's just a distraction.  So I'd unask that part of the question.

As for how to tell what machine on the network is the host system, your ability to do this in this special situation is about as good as the situation when there is no VM.  You have DHCP and ARP logs to go by.  If you can identify the IP address, go to your Ethernet switch and find which physical port that IP address is connected to -- then have a nice stroll to that port and have at it.  Don't forget to bring your clue stick.


Diffie-Hellman key exchange The following image attempts to explain the diffie-hellman key exchange for people not strong in maths such as myself:

I do understand how the colour/paint example illustrates the idea. But I'm a bit confused about how it maps to the use of very large numbers as is the case with the real protocol.
In particular the last stages of the image above,
Receiving each other's mixture of paint, they add their secret colour and end up with a common secret. This secret is the same colour in the picture. But what if some other secret colours were used, I mean that wouldn't guarantee ending up with the same colour would it?
How does that relate to the use of large numbers. Do they end up with the same number as the common secret?

With big numbers, Diffie-Hellman looks like this: we work modulo a big prime p, and we start with a conventional big integer g (in the 2..p-2 range). Each integer modulo p represents an achieved colour; g itself is the starting point, i.e. "yellow" in your picture.

Each paint is an integer; the range of possible paint tones is large (at least 2160). Mixing a new paint x with the current mixture v is modular exponentiation: the new mixture becomes vx mod p (you raise v to the power x, working modulo p, so you get back to an integer in the 1..p-1 range). Mixing no paint at all is equivalent to mixing the paint "1", because v1 = v mod p.

Diffie-Hellman works thanks to two characteristics:

One-wayness: given v and vx, it is hard to recompute x. In the paint analogy, anybody can mix paints, but nobody can "un-mix" that which was mixed.
Commutativity: mixing paint x, then paint y, yields the same result as mixing y then x. With numbers: (gx)y = gxy = (gy)x mod p. With paints, this means that putting yellow in blue yields the same green as putting blue in yellow. This is why Alice and Bob end up with the same colour.

In the picture, Alice and Bob start with yellow. Alice mixes orange in, while Bob uses cyan on his own paper. Then Alice and Bob swap their papers; Alice gets the yellow+cyan paper, while Bob now has the yellow+orange paper. Alice does not know that what she has at that point is yellow+cyan; she only knows that she has a mix of yellow and "whatever secret colour Bob uses". She then mixes in her own secret colour (the same that she used initially on her own sheet, now in the hands of Bob), and this gives yellow+cyan+orange. Similarly, Bob adds cyan to the sheet he got from Alice, and obtains yellow+orange+cyan, i.e. the same final tone. This works because each sheet was splashed with the secret colours of both Alice and Bob (orange and cyan), and the order of mixing does not matter for the final tone. This is secure because what travelled "on the wire" (in reach of eavesdroppers) is only mixed sheets: a spy would see a yellow+orange sheet, and even knowing that it is a mix of yellow and the secret colour of Alice, then working out that the secret colour of Alice is orange is hard.

Where the paint analogy breaks down: As all analogies, it is not perfect. There are two features of modular arithmetics that are crucial to security, and don't translate to paints:

Modular integers "wrap around". You can, at least theoretically, mix in a lot of distinct paints, and get back to the initial yellow. These number-paints can cancel each other; this is as if there were "negative paints" which remove pigments instead of adding new ones. With actual paints, extensive mixing can only reach some dark grey goo state.
Tones can be similar to each other, not integers. If a spy (let's call him Charles) observes the yellow+orange sheet from Alice, he can make experiments with yellow and his own stock of paints. For instance, if Charles mixes yellow with red, he will get something close to the sheet he observed, much closer than if he mixes yellow with blue. Charles could then try again with several shades of pink and ochre and orange, until he pinpoints Alice's secret colour. This would work with physical paints, but not with modular integers, where you have no way to guess whether you are "close" or "not close".

This illustrates a fundamental point: all of this protocol is about information. What Charles want is to "un-mix" the paints, but not necessarily to do so destructively; indeed, Charles' best interest is to let Alice's sheet reach Bob unscathed (there is no point in breaking a key exchange protocol if the victims don't actually complete the key exchange, and thus don't use the exchanged key). What Charles wants to do is to obtain a copy of Alice's secret colour (or at least a copy of the final tone), using his own stock of paints.


How do you prevent sending cookie data over HTTP the first time? You could use HSTS to tell browser to always use HTTPS in future requests.
You could use Cookie Secure flag that from now on only send cookies over HTTPS.
You could use DNS based redirect but only after HTTP request has gotten there..
My question is how do you make sure user always visit the site as HTTPS and never send any data over HTTP even the first time.
Edit:
Given lack of solution to this, I think browsers should automatically first send https request by default and it doesn't work then downgrade.
Edit:
Without comments the question, as is, and the answers do not make sense. Both seem to talking about different things so I want to give some context.

A user types in http://abc.com for the first time
abc.com is not in hsts preload list
So browser goes ahead and make a request over non ssl path
Request is intercepted by Mitm, and attacker makes request on behalf
server says update to ssl and send registration/login form
attacker upgrades HIS connection to server to SSL but doesn't tell user and proxy html to user. (doesn't tell user to upgrade to https because hacker provided cert would be invalid)
User inputs everything into http page
Hacker may even pass in its cookie to User.
Allowing for future data access until cookie is revoked.

In summary of the comments (and by replacing my previous answer): as long as sslstrip is possible the attacker can impersonate the user and control the session while the browser thinks that the user controls the session. Only HSTS can prevent sslstrip and only HSTS preload can prevent sslstrip on the first request (before getting a HSTS header).

Thus HSTS preload should be the way to go as pointed out correctly in the answer by Benoit Esnard.

The problem is, HSTS preload can take months to be available for a  new domain since an updated list ships only with a new version of the browser (at least in case of Google Chrome).

In other words: there is no solution which can be implemented within a short time.


Can anyone bypass preg_replace for SQLi in my app? In case of prevent SQLi happened I added this kind of check:

preg_replace("#([\[\]\|\.\,:'])#s", " ", $data);

This reg_ex should replace everything painfull, because the main query looks like

SELECT line FROM text WHERE tid LIKE '%{$data}%'

I put several encoded apostrophs trying to bypass my check and it seems pretty good protection.
What do you think?

There is no reason to implement your own sanitization logic in 2016. As Aria points out, you can just use mysqli_real_escape_string if you want to sanitize.
The key here is that this is NOT a 100% effective means of preventing SQLi.

The proper way would be to use the mysqli library to parameterize queries, because this renders first order injection impossible! You might see a lot of recommendations to use PDO to make prepared statements. It's important to note that prepared statements are not the same as parameterized queries. Prepared statements are just statements passed to a module that does the sanitization for you.

That's not to say sanitization isn't useful, it just isn't useful for preventing SQLi. You should still do it, though, to prevent stored cross site scripting. Strip out anything that a browser might recognize as HTML or JS or CSS if you're storing any untrusted input that might be displayed in a page.

TL;DR Parameterize your queries to protect from SQLi; prepare them to protect from stored XSS.

EDIT: I just noticed that your regexp doesn't seem to account for semicolons or dashes, so I could achieve injection against it quite easily.


Is there a superior approach for threat modeling? There are at least three different common approaches to creating a threat model:

Attacker-centric
Software-centric
Asset-centric

You can take a look at Wikipedia for a quick overview.

I wonder if one of those approaches has proven to be superior in general or if you have to choose them depending on the situation at hand. I have experience with all three of them and I personally prefer the attacker-centric approach because it feels straight forward and it fits my way of thinking. I can see the benefits of the asset-centric approach, especially if you want to see the business impact of certain threats directly. The software-centric approach feels clumsy and heavy-weight to me. If you want to drill in really deep and have a lot of time at hand for threat modeling it might be a good option though.

These are just my personal experiences. Is there an approach that has has proven to be superior in general or do you have to choose them depending on the situation at hand? Is there a common understanding about that in the Security Community.

I prefer asset-centric approach.
It works best for me, it usually easy to identify system assets and then to do threat analysis for each asset.

But whatever works for you (and your manager)

Regards

Aaron


Deal with number changes in a phone number based authentication/login system Twitter Digits (https://get.fabric.io/digits) provides an authentication/login system based on phone numbers for mobile apps, and several other mobile apps (e.g. Square Cash, https://squareup.com/help/us/en/article/5187-about-square-cash) has the same feature.

The problem with this type of authentication is that, what happens when some existing users change and abandon their phone number, and their old numbers get assigned to others (who may or may not be an user of the app)?

This poses a security risk, because whoever owns a phone number registered in the system at the time will have access to the account of the former owner(s) of that number as an user of the app. And it doesn't seem that Digits (or any provider of such authentication method) solves this problem, because they does not and likely cannot verify that if the current owner of a phone number is indeed the same person who register with an app using the same number in the first place.

At the same time, the fact that a money-transferring app (Square Cash) is using the same method makes me think if there is some reliable technique that may well solve the problem.

Any guess?

Yes if the login is only based on a phone number, the new possessor of a mobile number can install the app and access the account of the old owner of that phone number.

The solution would be to add a step for entry of password/secret key (information that the user only knows)

Also the user should be able to migrate to a new phone number by using the secret key.

Digits has implemented above two changes:
- http://get.digits.com/blog/launching-voice-verification-and-change-phone-number
- https://www.digits.com/settings

One problem still remains. The old owner of the phone number can login into Digits.com and either migrate to a new number or deactivate his account.

When he deactivates, the phone number must be released so that new owners of the phone number (or the same user if he continues to own the number) can register using it. But what if user did not deactive his number? The number would be blocked for new owner of the number for using in the app


Best guide/reference/roadmap for server penetration testing I have been assigned to pen test some servers and have been provided the IPs of the same. In my past I have worked on application security testing projects and am aware of OWASP 10, SANS 25 etc. but from the server perspective I am still new. I have scanned the IPs with Nessus & Nmap (for open ports). From here how should I proceed?

Should I use any more scanners and then try to create a manual POC of the findings I have found few Network adapters, internet webcams in the IPs provided? Is there any standard guideline document/guide/reference specifically for server penetration testing which I could refer or even any other ideas will be helpful.

I am not sure of any doctrine. General principals dictate recon, exploit, gain access, maintain access and clear tracks with continued access.

You may refer to:
https://technet.microsoft.com/en-us/library/2005.01.anatomyofahack.aspx?f=255&MSPPError=-2147217396 (Very old)

Or book

https://www.elsevier.com/books/penetration-testers-open-source-toolkit/faircloth/978-0-12-802149-1?start_rank=1&sortby=sortByDateDesc&imprintname=Syngress

Which gives you the tools (you should be able to grasp their sequence of usage).

Metapoilt / Kali or any other similar linux distribution will help you acquire more information about the targets. Find the vulnerabilities on the target using vulnerability databases. Exploit them to gain access and move laterally or vertically to increase your rights (from normal user to administrator).  If the targets are fully  patched and you find no documented software or firmware vulnerabilities (highly unlikely) You will have to look at exploiting their custom code - web-services for in-house use.

I love this document but again it doesn't directly answer your question. This is anatomy of a hack by the person who hacked in to http://hackingteam.com/

http://pastebin.com/raw/0SNSvyjJ

Also be extremely careful with your active actions.


Difference between system uptime and last boot time in windows As it shows in attached pictures, there is a "Difference between system uptime and last boot time" in my windows, it becomes an issue because AV, SIEM or every monitoring system shows a different time between system and boot.
Because of this problem, these workstations do not accept security policy from AV.

what is the reason?
How can I solve it?

The left window is not showing the system uptime but the network connection uptime.

The network may have only been up for a couple of hours for multiple reasons:

The network wire was -perhaps briefly- disconnected
The switch it is connected to was rebooted
The computer was previously connected to a different network, but then changed to this one
The network connection itself was disabled then enabled.
If it's just slightly different, it's normal that the boot time will have happened a bit before the computer booted, loaded the OS and actually connected to the network.

I can imagine a several scenarios where the reported system uptime is different than Now - Boot time for a machine, though:

The machine was hibernated and the time it was in that state is not taken into account for the uptime.
The system clock changed after boot, so the boot time might even be dated years ago (whatever the BIOS clock default is) but the System time itself was corrected shortly after boot-up through NTP.

I understand the discrepancy to show in SIEM / AV dashboards. However, I don't see that as a reason to not accept security policy from AV. If the AV refuses to apply a security policy because it considers that they don't match -as seems implied by their support reply-, perhaps it is buggy.


How do I actually air gap my CA computer? I remember reading about the necessity of air gapping the CA computer (never connecting it to any network whatsoever, no USB dongles etc).

I am preparing for setting up  a number of certificates (csr's for signing, client-sides certificates for client verification in Apache, WPA2 etc) and I wonder how do I actually air gap the computer. The main questions are:

How do I keep the OS updated?
How do I do the actual signing (i.e. transferring the csr's to the CA computer for signing and transferring the signed certificates back)?

I understand that using intermediate certificates can make my life somewhat easier, but I do not understand how - I still need to keep the intermediate certificates as safe as possible, don't I?

All Windows updates are available as downloads that you can apply locally, similarly for Linux. Enterprise management tools can also be used to provide networked updates without needing to connect the CA machine to the Internet. You could temporarily connect to the local network with a Windows firewall rule that only allows a connection to the address of the management server.
Intermediate Certificates act like the root cert but have a more limited scope. So you can create a set of intermediate certs for specific signing purposes and with short expiry dates to limit the impact of them being compromised. Yes, you still need to keep the intermediate certs secure but the impact of compromise is a lot less if done correctly.

If you need to create a new Intermediate certificate, you do so on the CA machine with clean USB stick or similar.

Clearly, you will understand that you must keep the CA machine physically secured. It should be in a secured cabinet in a secured room. Access to the machine must be tightly controlled and all access carefully recorded.

UPDATE: Someone else mentioned using a hardware encryption module (HSM). Certainly this would also improve security on the CA machine making it much harder to compromise the keys and is highly recommended. I should have included that before.


What are the subfields of cryptovirology? What are the subfields of cryptovirology ? On wikipedia I can only find one subfield : Kleptography

Are there other subfields and are they already all defined ?

Are you just looking for an enumerated list of topics?  Ransomware tops the list today.  But there are other malicious attacks that involve cryptography, including evading cryptography (such as protocol-downgrade attacks), exploiting asymmetric cryptography, deliberately introduced information-leaking side channels (aka kleptography), and the use of poor or questionable encryption (especially when a more trustworthy alternative may exist.)

If you haven't already, read Malicious Cryptography: Exposing Cryptovirology by Young and Yung.  It was the first thesis specifically exploring the topic of cryptography-based malware.  The authors maintain a site at http://www.cryptovirology.com, which is more up to date.  It has a lot more information that is probably better suited to answer your specific questions.


Should corporate security training be tailored based on a users' job role? I work in the Information Security team at my workplace. We work in the insurance and healthcare industry and work frequently with customer credit card, financial, and private health data.

Today I was meeting with security management to plan for this year's annual security training curriculum. We are thinking about customizing the training  modules for end users depending on their job role. As examples:

Additional, customized training modules for privileged users such as domain admins
A training module customized for non-IT employees working in customer-facing roles
A separate training module for developers, perhaps with a heavier focus on defensive coding and software development vulnerabilities - e.g: SQL injection

As the security risk associated with an IT domain admin level user is obviously very different from a non-IT customer-facing employee, it seems customizing the security training to the specific needs of the type of employee is reasonable. What may be important and relevant to an IT employee may not be so to a customer service representative working in a call center, so it seems a one size fits all approach is just ineffective.

However, I can also see the downsides of a customized approach. An end user could possibly reason that because they were not provided a specific module, that training module is not meaningful or important. In other words, it is possible to encourage end user employees to be more lax in their security habits as they associate only what they see in training as important. We want to avoid this perception.

Is customizing corporate IT security training based on job roles and the differing inherent risks associated with those roles a good practice?

What are some possible downsides to such a customized approach, other than described above?

The idea of customising the training to meet user requirements is in fact a very good approach. However, there will have to be certain additions to this approach which will then suit everyone in your organisation.

With that being said, it is very correct when you say that the training required for an application developer will not be the same as an HR person.

However, when you look at structure of ISO 27001, you will see that it has many  aspects which will be applicable to all departments, such as access control, asset management and disposal, Intellectual property rights management, Business continuity procedures, Employment procedures, Incident handling, Acceptable use guidelines, Clear desk and Clear screen and much more. You will see that each of these items which I have listed above will be applicable to everyone.

Your training approach should take all these into account while also making the training role-specific. I have been taking an approach that is department-specific. Some modules have been exclusively reserved for certain departments, while most modules are applicable to all departments. Your training schedule should list out all these.

Finally the topics that you impart to your employees should actually be within the limits of your organisation's Information security management system (ISMS). So, if you have a well defined ISMS, look through all the policies and procedures that have been defined for your organisation. This will give you a good starting point to define all your topics.


Yara rules not working in debian Yara rules are working on Windows 7 perfectly. I am able to scan and detect malicious commands in .exe malware files but when I run the same program in debian v8.6, it can't detect malicious commands in .exe.  When I run the same rule against a .txt file it works.

I don't understand what the issue is.

Yara rule:

rule isThis_Suspicious
{
    strings:
        $a = "CHAN"
        $b = "JOIN"
        $c = "arun"
    condition:
        1 of them
}

Output on debian v8.6 :

root@debian:/Thwart/yaraCmd/yara-3.7.1# yara -s rule2.txt test.txt
isThis_Suspicious test.txt
0x5:$c: arun
root@debian:/Thwart/yaraCmd/yara-3.7.1# yara -s rule2.txt  srvcp.exe

yara with -n

root@debian:/Thwart/yaraCmd/yara-3.7.1# yara -n rule2.txt test.txt
root@debian:/Thwart/yaraCmd/yara-3.7.1# yara -n rule2.txt srvcp.exe
isThis_Suspicious srvcp.exe

Why its not matching the rule in debian but the same rule is working on windows.

output on windows 7:

D:\yara>yara64.exe rule2.txt test.txt
isThis_Suspicious test.txt

D:\yara>yara64.exe rule2.txt srvcp.exe
isThis_Suspicious srvcp.exe

Yara should have the same behavior on all platforms.  As was discovered in the comments, it's important to make sure the rules files and targets are the same on both systems (by comparing sizes, sha1sums, etc.).  It's possible for file transfers/copies to get interrupted, leading to file corruption or truncation that results in incomplete YARA matches.


Where would you recommend me to store a Keepass-file? Where do  you store the KeePass-DB?

Where would you recommend me to store a Keepass-file? Usually I have my personal documents in my cloud account - but i am not sure if this is safe.
Would it be safe to use the cloud for this file? Can i secure it even further, by adding another (extra) layer of security by encrypting the file.
General question; How safe is this? What risks do I need to know about?

What can I do with the KeePass password file, there are several arguments to decide where to store it.
In my humble opinion, if the passwords are really, really important to someone, one should make the decision based on:

the risk of the file being hacked - what can we do if we consider to get hacked
the risk of losing the file because of having a bad hdd - what do you do if you face disk errors. And sure thing -. there are more things to think
what if someone may compromise the file
is it preferable that the DB file not get in the wild,
there may be more and other risks - which one do you take into consideration"?
what if my cloud storage account is getting compromised then having the credentials recovered by either brute force or some other attack vector.

What if someone may compromise the file?

  Options; can I secure it even further, by adding another layer of security by encrypting the file i am going to store in cloud storage
  online.
  regarding the master password: master password provides pretty good security as long as i choose a difficult to brute force password (long
  and truly random),
  on the other handside - a masterpassword still can't compete with an actual long encryption key.
  we can increase the resiliency of the KeePass database to brute force by increasing the number of PBKDF2 iterations
  we can  do this in KeePass under File > Database settings > Security: Personally, I use around 10,000,000 rounds (2 s delay).

well -- as mentioned above; I use the KeePass-cloud combination. The password database is encrypted using a key derived from a strong master password.
Even if somebody acquires the encrypted password database through the cloud account, a strong enough master password renders brute-force attacks infeasible.

What can I do with the KeePass password file?  Which of the arguments do you take into consideration, to decide where to store it?

The best place to store your Keepass DB file is wherever it is most convenient for you. With a sufficiently strong password, you could even post your DB online publicly and still sleep well at night. Just make sure to:

Use a long password (20+ characters) that is not guessable outside of brute force.
Set a high number of iterations used to generate the key from your password. (I use 5 million iterations for mine.)

I personally like storing my Keepass DB in Google Drive because it allows me to easily access my DB from both my phone and my laptops. As a bonus, it also is automatically versioned every time I update it. Tip: if you do use Google Drive or another service that versions your file for you, I recommend deleting the version history (or delete the file and re-upload), every time you change the master DB password.


Is it possible to War Drive for specific Bluetooth devices? What is the range? Is it possible for someone to remotely/covertly scan for Bluetooth devices?  If so, what is the operational range of this scanner?

My concern is that a Bluetooth based door lock will emit a signal that will draw too much attention to my home.

Well bluetooth scanner apps do exist (e.g. like this one ), so if the lock is broadcasting it will likely be discoverable.

As to range, as @adnan says in comments depends on the class, however there have been examples  of specialist antennas picking up signals over a mile away.


Encrypt password with salt Can anyone explain why formula 1 is safer than formula 2?I don't get it even I get the answer.

According to 2, it says as s is in plaintext form, the attacker can decrypt the password by (y.s).

Isn't it is the same for formula 1? That is, attacker can also decrypt the password by (y.s)

What is the difference between these 2 formulas which makes formula 1 to be safer than formula 2?

The process of judging the security of information stored in a password database is done with the assumption that an adversary (hacker) not only knows which cipher/encryption method you are using, but also that he has stolen a copy of your password database. Knowing those things, the hacker wishes to discover password so he can pretend to be a valid user.

In the problem described, the we assume the hacker has stolen the database and can see the values of both S and Y for every user contained in the database. The difference between the two methods is in what the value of Y consists of.

In method 1, [password] is combined with [salt] and then that value is block-cypher encrypted with key [password].

In method 2, [salt] is combined with [password] and then that value is block-cypher encrypted with key [salt].

The fact that the password and salt are mixed in different ways in the two examples is irrelevant; the critical fact you should notice is what key was used to create Y.

In method 1 the key used for encryption is password. The hacker doesn't know what the password is, since it has been encrypted before storing it inside Y in the database. In method 2 the key used for encryption is S. The hacker knows what S is, since it's right there in the database.

If method 2 is used, the hacker can decrypt Y immediately to discover password using the keyword S. If method 1 is used, he will have to break the encryption of Y without knowing the encryption key [password]. So method 1 is a more secure way of building a password database.


Is there any way to stop DDOS attacks? As many other webmaster I am facing problems with DDOS attacks. I have tried denying offending IP addresses from htaccess files and using bigger and better hosting, but I am unable to stop the attacks as new IP addresses are used.

If you're running a website that's under attack, you should consider a service such as Cloudflare.

Cloudflare and other CDNs are designed with DDoS attacks in mind - traffic passes through Cloudflare's network before it reaches yours. Since Cloudflare will filter DDoS traffic, only clean traffic will reach you.

On the other hand, if the attack is small enough to not saturate your port, and you feel comfortable enough dealing with it on your own, look into running Nginx as a reverse proxy in front of your Apache instance. Nginx is designed to handle floods a lot better than Apache can, due to the epoll architecture.

The way that services such as Cloudflare work are by 1) Mitigation appliances and 2) Having lots of capacity.

A mitigation appliance looks at anomalies in traffic, and matches traffic with known attack signatures in the past in order to distinguish legitimate traffic from DDoS traffic. The "dirty" traffic is dropped, while the clean traffic is passed on.

The best mitigation in the world doesn't help if your port is being saturated (Imagine sending 11gbps to a target who can only handle 10gbps). No matter how good your filtering is, you will go offline because your port is not capable of handling more than 10gbps. Services such as CloudFlare (any CDN or DDoS mitigation provider really) buy tons of capacity from transit providers in order to deal with huge volummetric floods - things that couldn't be handled at the server level because of the massive amounts of traffic (think 50gbps+)


Why is it a bad idea to use plain oauth2 for authentication? TL;DR: What are the security implications of using oauth2 for authentication?

I'm building an app (site A) that allows users to perform operations on another website (site B) through a simpler interface.

Site B provides an API that implements OAuth2.0 for authorization of my app.

I was thinking I could avoid storing passwords and having users get yet-another-account at my app by piggybacking on site B's authentication.

Of course I've read the literature bashing on the use of plain OAuth for authentication, but I fail to see how this is bad from a security perspective.

They seem to mostly focus on the practicality and (lack of) generality of the solution.

Here's the scheme I had in mind:

User Sally loads site A and clicks "login"
She's redirected to site B's authorization page, where she either authenticates or has an active session
If she authorizes site A to access site B on her behalf, she is redirected back to site A with an authorization code
Site A gets the authorization code and exchanges it for an access token (and a refresh token) through site B's API.
Site A asks site B for Sally's user_id and logs her in with that ID
The tokens are stored in a database for use by a backend, which does all the real work on site B.

I'll note that I'm using the so-called "server-side flow" here. Also, the authorization_code returned in the third step is a short-lived one-use code that's tied to A's client_id and can only be used with the corresponding client_secret.

When Sally logs in from another device the process repeats and the new tokens are stored.

The only problem I see is that the user will be asked to authorize my app on every login instead of just the first time, but that's not a problem at the moment. I'd also be asking for a new token when I actually have a valid one in store. While a bit impractical, this isn't a problem at the moment(*).

What I'm failing to see is how this is bad from a security perspective.

With such a scheme: What are the security issues for the user? And for the app?

I feel like I'm missing something.

(*) I won't have a big userbase, just a few whitelisted users. When (if) the app grows I plan to integrate it into a bigger site that uses a real OpenID Connect provider. I just want to keep it simple, small and focused during this pilot-test

Note: If you are looking for something like OAuth2, but for authentication, you should
  use OpenId Connect instead.

OAuth2 is meant for a user to authorize an application to load the user's resources from some resource provider. In other words: OAuth2 is a mechanism for delegation of authorization. The protocol does not support authentication (although it is commonly misused for exactly that).

The security hole is in the assumption you make in the 5th bullet point.

You say:

  Site A asks site B for Sally's user_id and logs her in with that ID

While in reality it should read:

  Site A asks site B for the user_id from the user-data that the access_token grants access to.

Figure 1: OAuth flow for (confidential) clients.

If all goes as planned, the access_token is, indeed, from the user you redirected to B for authentication. But: there is no guarantee that is the case. In fact, any (malicious) website that the user has previously granted the right to access the user's data (using OAuth2 with B), can get a valid authorization_code from B and send it to you, in bullet point 3.

In other words, if I run a website which asks users for their permission to access their resources at B using OAuth2, I can impersonate all those users at all websites which misuse OAuth2 (with B as OAuth2 Authorization server) for authentication.

The 'problem' with OAuth2 is that the authorization_code is not generated for a specific client_id. So if you receive an authorization_code, you can not be sure if B issued the authorization_code you received to you, or to some other service. Which is deemed acceptable for authorization but is absolutely unacceptable for authentication.

Update:
As to your comment:

  (and I restrict A to only accept one from users it previously redirected to B, but this is still unauthenticated)

I believe that you are here adding an extra precaution, which is not mandatory in the OAuth protocol. As such, it cannot be relied upon.


HTTP Response Splitting in practice Have you ever seen HTTP Response Splitting in laboratory environment?

There are many examples for HTTP Response Splitting vulnerability.

I used old PHP and managed to get 2 responses from server that are visible in wireshark:

HTTP/1.1 302 Found
Date: Sun, 30 Aug 2015 11:56:15 GMT
Server: Apache/2.0.47 (Win32) mod_ssl/2.0.47 OpenSSL/0.9.7b PHP/4.3.3RC2-dev
X-Powered-By: PHP/4.3.3RC2-dev
Location:
Content-Length: 0

HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 25

<html>Hacked !</html>
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1

If I render it in BurpSuite then I see html from second response,
but the browser does not show it and has different behaviour instead depends on browser.

When I look at the response in Live HTTP Headers extension for FireFox I see that the string "HTTP/1.1 200 OK" is absent.

How is it possible to see HTTP Response Splitting for Location header in browser?

For attacks using applications flaws, like in your example, the goal is to feed the content of the 302 response (with an empty location and a real HTML content. So the first response, the 302 response, will not have a Content-Length: 0. Put the 'hacked' in this 302 page, with a length. No location is given so the redirection will fail. The next response (the official response) is discarded. In this mode you do not care about the second response.

A browser behavior on receiving a response for something not yet requested is quite hard to predict. Unless HTTP pipelining is used on the browser this response would be simply ignored.

But the target of HTTP response splitting attack is not always the browser.

Such issues can be used for complex cache poisoning attack. The attacker will build the pipeline of queries (usually without a browser), so that the second query will get the extra response and could be poisoned in a cache.


how do CPU cache side-channel attack fit into the background of Meltdown vulnerability? NOTE:I know there are similar questions out there, namely this one, but that answer is just an extraction from original paper, which didn't clarify the attack. Additionally I can see from answers there are some meaningful discussion going, so I will still post this question until further suggestion of duplicate appears.

In some literature, I have seen some vague description like:

  the Meltdown vulnerability uses the cache as a side channel to leak the information found during step two. During the attack, in order to use the cache as a side-channel, the attacker must generate a significant amount of cache misses for every cache-hit, as the timing differences between the cache-miss and the cache-hit is used to gather the data.

Can somebody describe how exactly sensitive data the attacker wanted to know is determined byte by byte? and how does the page size (4096) plays a crucial part in here?

There's an XKCD for that!.

A page is the smallest unit of data for memory management in a virtual memory operating system. That means when data is moved in and out of caches it is moved in chunks of at least 1 page.

In the simplest case lets assume the attacker is interested in a single byte of memory. Lets say this byte is at address 0. The attacker sets up an array which is 256 pages long. Lets call this array "page_array". They then trick the processor into performing the following -

1. load address 0 into register[X]
2. load the byte at page_array[PAGE_SIZE * register[x]] into register[y].
   // PAGE_SIZE would usually be 4096

The CPU then realizes its mistake and undoes all of the above. But meanwhile the page containing page_array[PAGE_SIZE * register[x]] has been fetched and is sitting in the cache. i.e if the value were 1 you would expect -

bytes at page_array[0 to 4095] to be unlikely to be in the cache.
bytes at page_array[4096 to 8191] to be likely to be in the cache.
bytes at page_array[8192+] to be unlikely to be in the cache.

By timing access to page_array[PAGE_SIZE * i] for i in the range 0 to 255 the pages which load fastest are almost certainly in the cache. The difference is large enough that by selecting an appropriate threshold you should be able to somewhat reliably discern between a hit and a miss.

By repeating the same process multiple times and taking special steps to flush the array out of the cache before indexing into it a malicious actor can reach a point where they have the correct value with a very high statistical probability.


Client authentication Assume a server which offers some information which must not be exposed publicly.
A client of this which may be e.g. a windows service (or at least something executing headless) needs to access the information on the first server.

So the client needs to trust that he is talking to the correct server and the server needs to trust that he is talking to the correct (authenticated and authorized client).

The information transactions must be obscured, i.e. crypted.

What is the best strategy to achieve this kind of security when it is a requirement that the client is running silently, headless and cannot/shall not ask interactively for credentials from a user on the client site ?

Some kind of integration into AD (another forest) ?

Client certificate (number of clients is fairly low and the burden to handle this is not too big).

Other ?

As per my understanding of your needs, use SSL/TLS with mutual authentication (ie. client cert):

It will guaranty both ends identity,
Protect the communication confidentiality and integrity,
It is a well known standard, largely available allowing quick implementation.


employing SSL even on non critical web server I know that SSL should be used on web servers that need to gather credit card information etc..however, is it industry best practice to also turn on SSL even for non critical web servers? eg those only used for static browsing, or those that just require a simple login and password , that's all.

Would like to hear your comments. thanks

The cautious strategy would be to do SSL everywhere, then think about switching to non-SSL for some pages if (and only if) performance issues arise, that would be likely to be fixed with absence of SSL. Not using SSL means that passive attacker can see all the traffic, and active attackers can modify at will all the non-SSL parts, which can have deep ramifications. Thus, this is not something that should be done lightly. Mixing SSL and non-SSL content within the same page also tends to produce browser warnings or breakage, so doing partial SSL can be challenging.

"Performance issues" that may plausibly arise in the presence of an all-SSL world are about caching; with SSL, transparent proxies that cache data requests as they go, without clients being aware of it, can no longer work. Big ISP are quite fond of transparent proxies. On the other hand, "performance issues" that come to the mind of most sysadmins (namely, the "obviously" huge overhead of encryption) are, in fact, mostly mythic.

The industry practice is of course completely different. The industry, at large, goes without SSL, then adds it only reluctantly, long afterwards, for only some pages, and only after having spent all the excuses about how attacks on non-SSL pages are not their problem since they are client-side. For some reason, many sysadmins think about switching to SSL with the same mindset as an hardcore environmentalist that considers replacing a coal power plant with a nuclear one.


What parts of the javascript code can an XSS attack access? I understand that XSS attacks can access all globals (like cookies, storage, etc) within the context of the running javascript code, but I would like to understand if they could also have access to any in memory variables as well?
For example, there are some suggestions to keep the JWT in memory (and refresh it silently with the provider on page refresh). I would like to understand whether this would be susceptible to XSS or not, in what scenarios would this info not be accessible to an XSS attack?
For example, if i keep it in window.jwt, I believe it would be accessible, but if it is kept in, say, React component state, or in a closure, would it still be accessible or not?
Even if not accessible directly, since we would be sending this token with API calls in a header, would it still be possible to read the headers being sent out in the API calls and get the token value?

XSS can access anything a script can.
Why? Because XSS injected scripts are indistinguishable from other scripts. If you keep a JWT in memory, XSS can access and exfiltrate it.
How can you protect your token?
Store it in a cookie with the HTTPOnly flag.


Is there a way to check if Google Drive is scanning folders other than the ones I have synced? I have a piece of software that monitors C:\Folder1. It keeps it in sync with C:\Folder2. It encrypts everything in C:\Folder2.

I want to sync Folder2 to my Google Drive. But this additional encryption step is silly if they could scan my entire file system now that they're downloaded to my machine.

Is there a way to check what files a program accesses?

Is it already common knowledge that Google does this?

You can use Process Monitor.  This was developed by Mark Russinovich and was then bought out by Microsoft who gave Russinovich a job.

https://docs.microsoft.com/en-us/sysinternals/downloads/procmon

  Process Monitor is an advanced monitoring tool for Windows that shows
  real-time file system, Registry and process/thread activity

It can be a chatty old application to monitor though, so you might want to turn off AV and anything else that is running in the background.


entropy of FIPS-181 automated password generator From wikipedia article on password strength:

  NIST recommends 80-bits for the most secure passwords

Is there any estimation of entropy for FIPS-181 automated password generator?
Recommended length?

It generates pronounceable passwords like

  erinthec
  therglaz
  adentory
  denybier
  taillass
  alkhoray
  malteake

Note that FIPS 181 is from 1993, which is ancient, in computer security terms.
The paper doesn't say how much entropy the passwords have.  It does say:

  Approximately 18 million 6-character, 5.7 billion 8-character, and 1.6 trillion 10-character passwords can be created by the program.

The question is whether those passwords are all equally likely.  And indeed
the answer is no according to A New Attack on Random Pronounceable Password Generators.

But what that does give us is an upper bound on the entropy.  log2(1.6e12) is 40.5, so the best you could hope for is about 40 bits of entropy with a 10-character FIPS 181 password.  Stephen's calculation of 64 bits for 16 characters seems right, since this estimate amounts to about 4 bits of possible entropy per character, though again that would be an upper bound.  20 characters would max out at 80 bits of entropy.

It would be better to use something like the apg program, which include upper case, digits and special characters by default and you can ask for pronounceable passwords or not.

I looked at NIST SP 800-63-2 Electronic Authentication Guideline (Aug 2013) and didn't see anything like "NIST recommends 80-bits for the most secure passwords".  It does set out lots of scenarios and conditions.  I suggest reading it and applying it to your threat model.

RFC 4086 - Randomness Requirements for Security presents some example threat models and how to calculate the entropy desired for each one.  The answers vary between 29 bits and 128 bits of entropy needed.

See also
How Secure is a Pronounceable Password? In means of entropy - Cryptography Stack Exchange


Is TLS_ECDHE_RSA_WITH_RC4_128_SHA secure? I was wondering whether TLS_ECDHE_RSA_WITH_RC4_128_SHA is secure.
We have added it within the ciphers tag of the Tomcat configuration file.

RC4 in TLS is subject to bias problems. In a pragmatic sense, while this has been exploited in lab conditions, it isn't very likely that you'll fall victim to it in practice. However, the cost of disabling RC4 suites is usually zero; the only systems that still have no AES support are Windows XP on Internet Explorer, and if you're still supporting such clients then you have much bigger problems than RC4.

(EDIT: As per Thomas' comment below, XP doesn't support ECDHE either, so this suite still wouldn't work on XP anyway)

TL;DR - disable it, there's no good reason to keep it around.


Why is storing usernames in cookies bad? A commonly repeated advice over the web is not to store usernames in cookies.

However, I don't really understand the problem. What I'm doing in my web application is: I generate a 16-byte (converted to 32-bit hex) random session ID generated from a CSPRNG, and store the username and this session ID in cookies.

Needless to say is the fact that the existence of the session ID and its correlation with the user is checked from a database before performing any actions in the web application. I'm doing this to speed up the database access a bit, and to protect against the problem of collisions, where an user may find themselves authorized as a different user due to an accidental collision.

What is the weakness in this scheme?

People who say that are confused. You need to not blindly trust data stored in cookies for important operations, but storing non-confidential (and the username is not confidential) information in a cookie for convenience is fine. Just don't use it for security decisions without validating it first.

So, storing the username in a cookie to say "Welcome Alice, please log in." is fine. But trusting that the user is Alice just because a cookie says that is not. In that case, it would be too easy for Mallory to set their cookie to "Alice" and get access to Alice's account.


Custom SSL protection Message to Users in Web Applications In some websites, especially on their payment section, I see a text something like: You are on a secure page. Your personal data is encrypted and protected by SSL technology. However it looks like a custom message. Therefore, when I am attacked somehow ( by MITM, or with fake copy website), although, my browser alerts for a "not secure website", I might still see the text from the website that tells me to not worry.

I would like to ask the best practice about it. Should I implement a mechanism that checks if my front-end is really in SSL protection before printing this text? Or is it better to not write something like that and leave the protection message to only to the browser?

Thanks in advance.

This is security theater only used to invoke a warm fuzzy feeling of security in the end user. You correctly realized that a fake site could create such a message too. Personally I dislike these easily fakeable custom messages as much as I dislike similar (and also misused) disclaimers of antivirus products in mails.

In my opinion these messages deviate the user from looking at the real indicators of security. It is better not to train users to look for and trust such easily fakeable "indicators" and instead to publicly teach users how really trustable indicators for security look like. Only, some users already expect such shiny fake indicators and one might loose visitors if one is not playing the same security theater as the others :( Other users might simply not understand how to look for the real indicators.

If you need to play this theater too depends on your specific use case and the knowledge and expectation of your users. If you need it maybe use the chance to also explain to the users what the real indicators look like.


Good Vulnerable Wordpress VM or Lab? I am looking to dive into learning more about Wordpress vulnerabilities and conducting penetration testing against them. Are there any good "Vulnerable WP Sites?" that I can download as a VM to play around in? Sort of in the same vain as DVWA or Hackazon? An inital search didn't come up with much--and what did seemed to be single vulnerability labs.

Ideally I would like something that's no more than 2-3 years old.

Thanks!

Your best bet would be to look at specific vulnerabilities found in the WP Vuln DB

This site has exact application versions of when it was vulnerable, when it was patched and links to references.

You can get older releases of Wordpress off their site here

Also, if you don't have any experience with it, I recommend checking out WPScan which comes stock in Kali and Parrot OS

Anytime I see a wordpress site I run wpscan. It's magical. I also run it against my own blog usually once a month when I poke around my network.


Is it legal to find bugs on a website and report them to the website's owner? I'm from Canada, and I'd like to know one thing. I know a bug on one website. I'm not sure if it's legal here to search for bugs on a website and NOT use them; instead, tell its company about it.

It is legal to tell them about the bug, giving them a detailed description of the bug and how you came across it.

What is unpredictable is the company's reaction.  It could vary to something such as them sending you a reward/small gift (has happened to me), to them trying to prosecute you as a criminal (tipping them off anonymously could help with this issue).  If the bug compromises the website and it's information, make it clear that you have not used the bug in this way.

If you have the knowledge, try to make suggestions on how to fix the bug, to make it even clearer to the company that you are trying to help them out (something I did as well).

Important note: If the company refuses to recognise the vulnerability, do not seek way to exploit it and get it attention.  This will most likely result in legal action against you.


Are MITM attacks possible on HTTP loopbacks? I have a web server running at example.com. The web server performs a server-side request to example.com which results in a loopback, so the request never passes over the network.

Is this request susceptible to a MITM attack? If so, how?

The problem is all in accessing the server and gaining a suitable privilege level.

update: and of course if you have such an access, you can probably take control directly of either the "server" or the "client", or both, or covertly access their same data unbeknownst to them. No need of a man in the middle if you're the man inside.

But say you have root there... then, yes, you can mount a MitM attack even if you can't use anything but the loopback interface for whatever reason, and cannot otherwise interfere with client's or server's operation.

All you need is lovecalhost duplicating its address to something useable, and telling the victim that example.com maps to that address.

Practical example using a service I have listening on localhost port 631 - cupsd. A webserver would listen on port 80, but everything else stays the same.

netstat -napo | grep LISTEN | grep -F 127.0.0.1
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1321/cupsd          off (0.00/0/0)
tcp        0      0 127.0.0.1:953           0.0.0.0:*               LISTEN      1721/named          off (0.00/0/0)
tcp        0      0 127.0.0.1:53            0.0.0.0:*               LISTEN      1721/named          off (0.00/0/0)

Now I cannot listen straight away on the chosen port since there's a legitimate process already there:

# netcat -l 127.0.0.1 631 &
[1] 26264
netcat: Address already in use
[1]+  Exit 1                  netcat -l 127.0.0.1 631
#

But nothing stops me from creating another loopback interface (lo:0 instead of lo) using aliasing...

# ifconfig lo:0 127.0.0.42
# ifconfig lo:0
lo:0      Link encap:Local Loopback
          inet addr:127.0.0.42  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1

and telling the system that example.com is indeed 127.0.0.42 by manipulating the hosts file (if the DNS had priority, I'd tweak its zone file)...

...and now I can listen (in this case to a single line)

# netcat -l 127.0.0.42 631 &
[1] 26442

and if I send that line, my listening netcat receives (and could reply):

# echo "Hello" | netcat 127.0.0.42 631
Hello
[1]+  Done                    netcat -l 127.0.0.42 631
#

Nothing has traveled outside the loopback interface (except that of course how am I inside that box if it has only a loopback interface?), and if the connection goes to "example.com", the server has no way of knowing the connection is being hijacked.

I could try and do this even without aliasing, but the required procedure would heavily disrupt communications and might not work always, or even at all, since I cannot easily prevent client and server from hearing one another.

(The aliasing I did here is just a proof of concept, and would probably cause havoc down the line - just consider I have now 127.0.0.1 and 127.0.0.42 on the same "trunk" and they both have /8 masking)


Is TrueCrypt still safer than VeraCrypt? I know that TrueCrypt was considered safer over VeraCrypt a few years ago. But does this situation remain the same? It was because TrueCrypt was audited and VeraCrypt was not and there was just more eyes watching TrueCrypt than VeraCrypt, is this still true?

I also heard VeraCrypt was audited and they didn't find any backdoor, do you belive it?

VeraCrypt is a fork of the now abandoned TrueCrypt project. I really wonder where you have found the information that TrueCrypt was safer than VeraCrypt. More exactly, it may have been true in the early times of the fork, if some security patches had been implemented in TrueCrypt before being ported in VeraCrypt. But as TrueCrypt is no longer maintained, while VeraCrypt started from the same code and is actively maintained, I would now trust VeraCrypt more than the good old TrueCrypt.


Runtime checksum of Mach-O differs from executable checksum In our iOS application we are trying to make an anti-tamper check.
What we would like to apply is a common procedure used in anti-tapering techniques. We are trying to get the __text section of a Mach-O file and obtain a checksum from it, this checksum would be obfuscated in a separate file and matched with a checksum obtained at runtime by the running app.
In particular the procedure we are applying is based on that code (credit to applidium):

#include <CommonCrypto/CommonCrypto.h>
#include <dlfcn.h>
#include <mach-o/dyld.h>

int correctCheckSumForTextSection(const char * originalSignature) {
  const struct mach_header * header;
  Dl_info dlinfo;
  //
  if (dladdr(main, &dlinfo) == 0 || dlinfo.dli_fbase == NULL)
    return 0; // Can't find symbol for main
  //
  header = dlinfo.dli_fbase;  // Pointer on the Mach-O header
  struct load_command * cmd = (struct load_command *)(header + 1); // First load command
  // Now iterate through load command
  //to find __text section of __TEXT segment
  for (uint32_t i = 0; cmd != NULL && i < header->ncmds; i++) {
    if (cmd->cmd == LC_SEGMENT) {
      // __TEXT load command is a LC_SEGMENT load command
      struct segment_command * segment = (struct segment_command *)cmd;
      if (!strcmp(segment->segname, "__TEXT")) {
        // Stop on __TEXT segment load command and go through sections
        // to find __text section
        struct section * section = (struct section *)(segment + 1);
        for (uint32_t j = 0; section != NULL && j < segment->nsects; j++) {
          if (!strcmp(section->sectname, "__text"))
            break; //Stop on __text section load command
          section = (struct section *)(section + 1);
        }
        // Get here the __text section address, the __text section size
        // and the virtual memory address so we can calculate
        // a pointer on the __text section
        uint32_t * textSectionAddr = (uint32_t *)section->addr;
        uint32_t textSectionSize = section->size;
        uint32_t * vmaddr = segment->vmaddr;
        char * textSectionPtr = (char *)((int)header + (int)textSectionAddr - (int)vmaddr);
        // Calculate the signature of the data,
        // store the result in a string
        // and compare to the original one
        unsigned char digest[CC_MD5_DIGEST_LENGTH];
        char signature[2 * CC_MD5_DIGEST_LENGTH];            // will hold the signature
        CC_MD5(textSectionPtr, textSectionSize, digest);     // calculate the signature
        for (int i = 0; i < sizeof(digest); i++)             // fill signature
          sprintf(signature + (2 * i), "%02x", digest[i]);
        return strcmp(originalSignature, signature) == 0;    // verify signatures match
      }
    }
    cmd = (struct load_command *)((uint8_t *)cmd + cmd->cmdsize);
  }
  return 0;
}

originalSignature is obtained by a command line tool after the build phase launched against the just produced Mach-O file.

We successfully managed to obtain the __text section from runtime and from the file, the problem is that the checksums are different each other.
Inspecting the issue we've found out that the memory map obtained from the runtime and from reading the Mach-O file is almost identical, except from a few hex values (in a small program about 6).
Using a disassembler it seems that those different values are coming from printf or sprintf implementation.
We use those functions to process the signature.

How is such behavior possible? Is there any other methodology that can be used in order to retrieve the original signature from the Mach-O file without modifying the source?

It is important to note that we cannot in any way hardcode the value of the original signature since that change would invalidate the previous one.

This is because of the dynamic linker, dyld.

Certain sections of the __TEXT segment, such as __stubs get modified in memory by dyld so as to be able to call out to the linked symbols. Basically it is dynamically inserting the correct memory address for your externally linked functions like printf and sprintf.

Incidentally, this whole setup sounds rather silly, as code-signing already does this and more. So long as they are modifying the code, they will might as well modify your additional integrity checks too. It's hard to believe you won't end up spending more of your time on this than a half-way decent hacker will spend defeating it.


The main things a cloud data center could inject into its hardware So some cloud service providers like Amazon use custom hardware to improve different characteristics of their servers. This also means they can control the security better, because there is nothing hidden inside their silicon since they made it. But as a consumer, you don't know if AWS itself could have hardware or firmware on these custom servers for doing stuff with your application/processes.

What I'm wondering is what you can do purely from the motherboard or server / hardware level. The types of things that can be injected directly into the circuit design or the design of some other random hardware component that you would never be able to tell from an application-layer perspective. Wondering what can be done from here.

For clarification on the types of things I am looking for, here is an example. I don't know too much about the electronics of how networking and wifi work, but maybe there is a way to add some chunk of invisible hardware that sends every instruction and 1 and 0 out to a specific local ip address or something, and then from there you could simply build applications around that to log all traffic to every server. Basically, you could know how every program is run. Wondering if this type of stuff is possible at the hardware level, or if you need more operating-system level stuff to accomplish this.

Amazon can do absolutely anything they want with custom hardware.  Make copies of your passwords before you get a chance to hash them?  Sure.  Send every credit-card number they see to the Russian Mafia?  Sure.  Corrupt the results of your scientific-computing effort, then publish a paper with the real results before you get a chance?  Sure.  It's all a question of how much effort they're willing to put into it.

From the 10 Immutable Laws of Security:

  Law #3: If a bad guy has unrestricted physical access to your computer, it's not your computer anymore

With cloud computing, it was never your computer to begin with.


Authentication Schemes With Server-Side Password Hash Only We all know what HTTP Basic Authentication is all about:

Authorization: Basic base64(login + ":" + password)

HTTP Digest is a major improvement over Basic in that it does not transmit password in clear text, but on the other hand said plain-text password is stored on the server.

My question is, are there any authentication schemes that work with server only having a hash of the password?

What I recommend:

Hash the password on the client's side. The client then knows the hashing mechanism for the first stage of the process. Send this hashed value to the server. Now get the server to salt and hash this already hashed password. This way, an eavesdropper will only have access to the hash at any given point, and the server will never see the plaintext.


How does System Memory Dump work? So there are so many pen-testing tools that perform a memory dump on the system. How exactly do they work - what exactly happens ?

A core dump, either of the entire system, or single executable, is the entire contents of that processes' memory, or in the case of the system, everything's memory, written out to a file. There can be a lot of data in such a dump - here's an abbreviated form of the memory space of gvim, which I'm currently running:

pmap 19133
19133:   gvim fsstate.py
0000000000400000   2184K r-x--  /usr/bin/gvim    ; program code
0000000000821000    100K rw---  /usr/bin/gvim    ; program code again
000000000083a000     52K rw---    [ anon ]
0000000000a39000     56K rw---  /usr/bin/gvim    ; more program code
0000000002469000   3592K rw---    [ anon ]
0000003d53c00000     16K r-x--  /lib64/libuuid.so.1.3.0 ; shared object
0000003d53c04000   2044K -----  /lib64/libuuid.so.1.3.0
0000003d53e03000      4K rw---  /lib64/libuuid.so.1.3.0
0000003d55000000     28K r-x--  /usr/lib64/libSM.so.6.0.1
0000003d55007000   2044K -----  /usr/lib64/libSM.so.6.0.1
...
00007f46d66c7000     20K r----  /usr/share/locale/en_GB/LC_MESSAGES/gdk-pixbuf.mo
00007f46d66cc000      4K r----  /usr/share/locale/en_GB/LC_MESSAGES/libc.mo
00007f46d66cd000     56K r----  /usr/share/locale/en_GB/LC_MESSAGES/gtk20.mo
00007f46d66db000     28K r--s-  /usr/lib64/gconv/gconv-modules.cache
00007f46d66e5000      4K rw---    [ anon ]
00007fffc9ed9000    132K rw---    [ stack ]    ; stack!
00007fffc9f9b000      4K r-x--    [ anon ]
ffffffffff600000      4K r-x--    [ anon ]

From that address space, shared objects wouldn't be dumped, but everything else, stack, heap, would be. Addresses will be relative to certain versions of shared objects and potentially with ASLR they may not line up process to process. A kernel dump can be configured to contain varying amounts of information, from small dumps to everything.

What does this tell you? Exactly the state of the system or program at the time of being dumped - what it has on the stack (and so probably which function it is in). Most core dumps also contain other useful information like what is in the registers of the processor at the time of the dump.

In terms of how you work out what is going on, EIP or RIP on x86 (x64) will tell you at exactly which memory address the process was executing. rbp or ebp will tell you where abouts on the stack your function is working. You'd expect to find local variables there. You could also potentially look for all system calls and their arguments made in a core dump.

All of this serves to tell you what is going on with a process at that specific point in time. It isn't just a tool for pen testing either; it's possible to analyse core dumps as a form of debugging applications, particularly where running debuggers is hard or impossible. For example, you might analyse a kernel core dump to work out why the kernel crashed (what was it doing when it panicked?) rather than attaching a debugger and trying again - it also allows other people to send dumps to you for analysis.

How does this help with pen testing? The same way debugging helps with pen testing. You can see what's loaded in memory, what the current state is. You can work out what a process might be doing when you took the dump and perhaps most crucially, any data stored in any executable in memory (heap, stack etc) will also end up in the core dump, including passwords stored as plaintext in memory.

What do the analysis tools do? Look for patterns and structures indicative of a potential exploit (or error, if you're after debugging). A full explanation of that is probably beyond the scope of this box - there are many books dedicated to techniques for analysing memory dumps. Much of this is also system and architecture dependent; techniques for Windows x86 are different to techniques for Linux on MIPS.

As an example of something that might be indicative of an error, here's an example AviD will really appreciate:

push    rbp
mov rbp, rsp
sub rsp, 32
mov QWORD PTR [rbp-24], rdi  ; this is a char* argument stored on stack
mov rdx, QWORD PTR [rbp-24]  ; and this is a pointer loading it into a register
lea rax, [rbp-16]            ; this is only 8 bytes further down
mov rcx, QWORD PTR [rdx]     ; load contents of rdx into rcx
mov QWORD PTR [rax], rcx     ; put those 8 bytes to rbp-16
mov rcx, QWORD PTR [rdx+8]   ; load next 8 butes
mov QWORD PTR [rax+8], rcx   ; write to rbp-8
mov rcx, QWORD PTR [rdx+16]
mov QWORD PTR [rax+16], rcx  ; write to rbp
mov rcx, QWORD PTR [rdx+24]
mov QWORD PTR [rax+24], rcx  ; write to rbp+8
mov rcx, QWORD PTR [rdx+32]
mov QWORD PTR [rax+32], rcx  ; write to rbp+16
mov rcx, QWORD PTR [rdx+40]
mov QWORD PTR [rax+40], rcx  ; write to rbp+24
mov rcx, QWORD PTR [rdx+48]
mov QWORD PTR [rax+48], rcx  ; write to rbp+32
mov rdx, QWORD PTR [rdx+56]
mov QWORD PTR [rax+56], rdx  ; write to rbp+40
lea rax, [rbp-16]

As you can see, the first space available to this function on the stack for local variables was rbp-16 and below. Above that, we've just happily clobbered a stack frame with a whole pile of data, probably causing the program to crash. However, this code may well indicate a possible exploit. Looking for patterns like that in a crash dump is what makes them useful, and moreover rip in this case will tell you exactly which memory access caused the problem, because it'll point at the offending instruction (in theory).

In case you're wondering, the offending piece of code was simply a memcpy from an unbounded buffer into a much smaller target space. The function call to memcpy was optimised out.


Configuring burp to use in proxy environment My university internet connection runs behind proxy.  Its host name is 192.168.1.103 and port no is 3128.  How do I configure proxy in burp suite if I should enter above proxy setting in my Firefox browser?

Following method I have tried but fails:

I have set manual proxy as "127.0.0.1:8080", but my browser could not load any site after that proxy change.

Configure your browser to point to Burp's proxy details (e.g. 127.0.0.1:8080) and then configure Burp to use an upstream HTTP proxy for all target hosts (* as the destination):

However, if the upstream proxy is SOCKS, not HTTP, you need to configure it underneath (under the SOCKS Proxy heading) instead. This causes everything to be fed through the proxy. At the moment, Burp doesn't support per-target SOCKS proxies, but this shouldn't affect your situation.

For more information about Burp's capabilities, go to Help -> Burp Suite Help. Information about proxy settings can be found in the Suite Options -> Connections section of the help.


Vulnerability in Composer/MeekroDB WhereClauseTest.php? I have a development webserver for which the domain is not published or used (legitimately) by anyone other than me.  However, I'm seeing hits in my access and error log for the following file from unknown IP addresses:

https://example.com/vendor/sergeytsalkov/meekrodb/simpletest/WhereClauseTest.php

Yes I am using Composer and have the 'vendor' directory published in my main www directory.  Will be moving this to an inaccessible directory right away.

Is anyone aware of a vulnerability/exploit that bots may be trying to find by hitting this specific URL?

Take a look at what that PHP script does:

https://github.com/SergeyTsalkov/meekrodb/blob/master/simpletest/WhereClauseTest.php

It's a way to open the door to the DB by adding known usernames and passwords.


Using OAuth2 with JWT, should a client pass along unused refresh tokens on a logout call? I have a system with an OAuth2 authorization server. It hands out JWT access tokens and refresh tokens (the latter only to the mobile app client).

We don't persist access tokens (as is normal with JWT) but we do persist the (hashed) refresh tokens together with some meta data to be able to revoke them so that users can log out other devices. We also only allow a single use for refresh tokens, the new request also gives back a new refresh token.

The OAuth2 login server itself uses regular basic auth with sessions. The user wants to be able to logout (single devices/clients) here. So of course I have to invalidate the session itself. But ideally I want to remove the refresh token that this client still has as well. The problem is that I don't know that refresh token. A particular user could in theory have request multiple of them with their code request. The refresh token is also not normally passed in requests (only the access token)

Should I ask the clients (which are currently all under our own development) to send along their unused refresh tokens? Even if they 'forget' their refresh tokens locally, it still seems better if I also delete them on the server so they don't linger around until their expiry time.
Note I do know all the refresh tokens currently in use for a certain account but I don't want to just delete them all because that would mean all devices are logged out. We also save some user agent-like info with the refresh tokens so users can use that to manually logout other devices, but it seems like a bad idea to try to perform string matching on those to automate that process.

I would suggest alternative - that I encountered in one OAuth server implementation.

Instead of requiring clients to provide all refresh tokens for invalidation simply store logout record for some time.

The logout record would contain user identification, client identification and logout timestamp.

Your server do not need to know all invalid tokens, because it can assume that any presented token - that was issued before last logout - is invalid.

You need only one logout record for user-client pair - as later logout would also invalidate earlier tokens. You also need to store it no longer than the longest token time to live.


Testing a chroot environment for privilege escalation vulnerabilities I'm looking for holes in my current implementation of a chroot jail that I have implemented for a group of users.  Is there anything I can do better here?

I utilized the following packages:
RHEL6
openSSH
jailkit

The user runs a standard shell, not the jailkit specific shell, but I configured openSSH to start the users chrooted via the MatchGroup directive.

Only ssh access to this server is enabled.

I utilized jailkit to build the jail itself and resolve the needed library dependencies.

I build the jail using copies of all the required files instead of hard links.

Each user has their own jail and the mount point for the jails is mounted nosuid.

The users do not require anything needing SUID so I take care to strip all such SUID bits within the user's jail, not that it matters much with the nosuid flag on the mount.

All files outside of the user's home directory are root owned.

The following is the complete list of commands, paths, and devices I've made available to the users in the jail.  Pretty standard stuff:

/dev/random /dev/urandom /dev/null /bin/vi /bin/env /usr/bin/which /bin/hostname /usr/bin/id /usr/bin/file /usr/share/misc/magic /lib/libnsl.so.1  /lib64/libnsl.so.1  /lib/libnss*.so.2  /lib64/libnss*.so.2  /etc/nsswitch.conf  /etc/ld.so.conf  /bin/sh  /bin/bash  /bin/ksh  /bin/ls /bin/cat /bin/chmod /bin/mkdir /bin/cp /bin/cpio /bin/date /bin/dd /bin/echo /bin/egrep /bin/false /bin/fgrep /bin/grep /bin/gunzip /bin/gzip /bin/ln /bin/ls /bin/mkdir /bin/mktemp /bin/more /bin/mv /bin/pwd /bin/rm /bin/rmdir /bin/sed /bin/sh /bin/sleep /bin/sync /bin/tar /bin/touch /bin/true /bin/uncompress /bin/zcat /etc/motd /etc/issue /etc/bash.bashrc /etc/bashrc /etc/profile /usr/lib/locale/en_US.utf8 /usr/bin/awk /usr/bin/bzip2 /usr/bin/bunzip2 /usr/bin/ldd /usr/bin/less /usr/bin/clear /usr/bin/cut /usr/bin/du /usr/bin/find /usr/bin/head /usr/bin/less /usr/bin/md5sum /usr/bin/nice /usr/bin/sort /usr/bin/tac /usr/bin/tail /usr/bin/tr /usr/bin/sort /usr/bin/wc /usr/bin/watch /usr/bin/whoami /usr/bin/mc /usr/bin/mcedit /usr/bin/mcview /usr/share/mc /etc/terminfo /usr/share/terminfo /usr/bin/joe /usr/bin/nano /usr/bin/vi /usr/bin/vim /etc/vimrc /etc/joe /usr/share/vim

To complicate things, I have an automount exposed within the jailed user home directory which mounts a remote FUSE/sshfs filesystem as root with the following options: ro,noexec,nodev,nosuid,nonempty,noatime,follow_symlinks,allow_other,auto_cache,max_read=65536
Each user gets thier own automount entry hard coded to the jailed user home.

I have compiled all the exploits I could find intended to break out of the chroot and intentionally put them in the jail.  Without removing the 'nosuid' directive from the jail mount, owning the file to root, and setting the SUID bit on one of them, I have been unable to break out.

Anything else I'm missing?

bash can establish tcp connections, you shouldn't forget to check your firewall.
Maybe you would like to drop all traffic from the users with iptables -A OUTPUT -m owner --uid-owner youruser -j DROP but this shouldn't replace your firewall.

If the user is able to open a connection he could scan the network and exploit vulnerable services to break the jail or compromise over servers.


Can Solaris' shadow hashes be created by better algorithms than the default DES-based hash? By default, Solaris uses Traditional DES to encrypt password hashes in the shadow file.

Is there a way to harden the security by changing this default behaviour and make it to be hashed using a stronger algorithm?

You can choose the algorithm used between one of these (older Solaris releases might not have all of them available):

Traditional Unix crypt
BSD/Linux compatible md5
Blowfish
SHA256
SHA512

To change the algorithms accepted for existing passwords and used for new ones, modify the CRYPT_ALGORITHMS_ALLOW and CRYPT_DEFAULT variables in /etc/security/policy.conf file.

This is based on plugins so should you want custom encryption methods, you can install third party ones or develop your own.


Does setting a WiFi AP to channel 14 avoid the most common detection methods used in Europe or the Americas? The legally allowable band for WiFI in the US covers channels 1-11. Europe goes to 13, Japan to 14. I suspect that most tools use the WiFi driver of the machine and only scan for the channels it is limited to. Do you know of any tools that scan higher channels by default? With configuration?

For some examples of things that will detect these:

A modified firmware Linksys with extra channels opened up and run in analyzer mode.
A radio spectrum analyzer.
A USRP (kind of like above, but we can decode and talk back).

EDIT AND REDIRECT: I know how to perform this attack and detect a rogue access point that is out-of-band, whether it be WiFi or any other continuously operating transmission device. The point of this question is to discern whether most organizations would pick this attack up or are even aware of it in cases where somebody has placed an access point without company knowledge. I am aware of FCC communication rules and how they prohibit this. That said, it is the detection of such a device that is of concern, and that does not rely on illegal transmission.

Many security reviews include scanning for unauthorized WiFi devices, including the PCI DSS standards (11.1). What I seek are answers related to whether this attack vector is commonly accounted for.

Usually within the U.S., special-ordered equipment is required to scan channels not permitted for operation by the FCC.  This could be WiFi devices imported from overseas, or specially-licensed equipment manufactured specifically for spectrum analysis.

Since consumer electronic devices (including Wi-Fi) sold within the U.S. must conform to FCC Part 15 regulations, which do not permit operation in certain channels, I'm fairly confident hardware manufacturers have taken every measure to ensure that their devices are literally incapable of operating (transmitting or receiving) on those frequencies.  At the very least, I expect specialized firmware hacks would be required to work around those measures.  On the higher end, it's entirely conceivable that the device has been physically engineered so that it cannot work on those frequencies regardless of what it's told to do.

It should be noted however that:

As already stated, unlicensed operation in channels 12-14 on the 2.4 GHz band (as well as a number of channels in 5 GHz) is illegal in the U.S..  One may be subject to fine by the FCC if caught in violation.
Operating in such frequencies where not allowed by law is not a real security measure.  It is simply another form of "security by obscurity".  If an attacker has knowledge that a network is using illegal frequencies, or has equipment that can detect and connect to networks operating in those frequencies, that network is as vulnerable to the attacker as any network that is operating legally.


"Fix" man in the middle I've just tried to ssh connect to a server (auth via ssh key), and get the well-known message WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!. I'm the server administrator (but I'm not really a good server administrator) and does not change anything on this server. Another co-worker can go to this server (auth via ssh key too) and does not have the error. And another server can connect to this server (auth via ssh key).

So this only happens to me. I regenerate the key with ssh-keygen -R xxx.xxx.xxx.xxx, and now there is no problem. Everything is "fine" now, but I don't know if there is a security problem. Doing that, did I fix the man in the middle problem, or am I exposed? What should I do if so?

In other words, my question is: Should I panic?

One other side question: is it the right place to ask this kind of question?

P.S: Key type was ssh-rsa and is now ecdsa-sha2-nistp256. Don't know why, it's still ssh-rsa for my co-worker

I regenerate the key with ssh-keygen -R xxx.xxx.xxx.xxx

This is not a key regeneration! It is key removal from your known_hosts file. If there was man-in-the-middle, the attacker now can be authenticated to your server!

You should check the server keys from your machine and from your co-worker if it gives you the same set (good tool for getting all public ssh-keys from server is ssh-keyscan). It is normal that server has more different keys (and key types), but without knowing what was in your known_hosts file before you removed it, you have no chance to find out what caused the problem.

If you still have the old public key from known_hosts, before you removed it, check what key has your co-worker stored for that server and what are the actual keys on the server (preferably by physical access to the server, but also the ssh-keyscan can help). If it differs somewhere then you should investigate further your infrastructure or your machine and server, because then there can be some real problem.


How to remove MBR Rootkits/bootkits? How do I remove them from internal hard drives and USB sticks? Can they infect MicroSD cards as well or anything else? DVD? cd?

Heard it's possible to do with a live CD via formatting. What are best methods?

Consider using a tool that can clean your MBR, like Boot Repair Disk. Make sure to wipe the MBR, and not repair it, as generally you can't know if the malware would be removed by repairing.

I guess it is fair to assume that if you have a writable MBR, it could be infected. Thus, yes, an attacker could infect MicroSD cards. DVD/CD (optical drives) function differently (see UDF and ISO 9660), they do not use a MBR.

For the creation of a Live CD, it's best to use dedicated software as it takes care of different variations, be it hardware/firmware or configuration, such as OS or partitioning.

So, if you need to make sure you have removed any possible malware on the drive:

Create a clean MBR, practically redoing the partitioning of the drive.
Format your new partition(s).

Both steps are necessary, because these are two logically different steps and generally doing one does not affect the other.


How to remote monitor a computer network traffic? I would like to know if it is possible to remote monitor the incoming and outcoming network traffic of a specific IP from my network. I need to log the time, ip numbers and port that contact the computer as well the answers.

I cannot change any configuration/install of the machine. (so cannot install wireshark or a lower level app like tcpdump)

best regards,

I'm assuming that what you're doing is related to ethical pen. testing. If you have no legitimate control over your target, you have 3 options

Haxoring your target: Attempt to gain access to the target machine by exploiting some vulnerabilities in the machine itself, or the operator of the machine.
Big Man in the Middle (Between your target and the servers to which he's connecting): Attempt to gain access to the network device used by your target. For example, find some vulnerabilities or default passwords in the routers or gateways your target uses.
Man in the Middle (Between your target and his local network gateway): Attempt to trick your target into sending his traffic through you. By far, the easiest way to achieve this is through ARP Spoofing. An easy-to-use tool is Cain and Abel.

(Cain and Abel)