Protection against Android Reverse Engineering I have been particularly trying to find the most effective measures to protect an apk from Reverse engineering and abusive use.
While continuing my research I came across various top rated apps and one of them which garnered most of my attention(as well as others perhaps) was Snapchat.

Now, Snapchat had tried to rebuild its security measures and tighten its knots to prevent abusive use of its app following 2017 fall releases.
Long story short, Snapchat started using a special header called X-Snapchat-Client Auth Token to sign all requests originating from the App.
The beauty being a simple decompile and recompile leaves the app useless and it perhaps boils down to the special header which helps detect Snapchat servers that the request is illegitimate and originated from untrusted sources and hence should not be entertained.

This special header is actually prepared by a special native library called libscplugin.so which is called by the app during initial login and helps generating the header and signing the requests.
On doing a bit digging I discovered this library(which is actually a shared object(.so) and cannot be decompiled easily unlike other .dex files) makes following java method calls :

com.snapchat.android.app.shared.crypto.DeviceTokenManager.getInstance
com.snapchat.android.app.shared.crypto.DeviceTokenManager.getDeviceToken1

which is understood as it might be doing some stuffs with Device token.

And, There are following calls  as well :

java.lang.ClassLoader.loadClass
dalvik.system.BaseDexClassLoader.findClass
dalvik.system.DexPathList$Element.toString
and a lot number of other Dalvik and String method calls

I want to understand what this particular method of protection is and how it helps Snapchat identify an unauthorized app.
What do the above method calls symbolize or convey a message?
Is it trying to attain the App signature from the native layer or trying to compute the state of the dex files or anything which I'm not aware of and is very interesting and helpful and using it further to generate the attestation token?

Whatever these calls do, it's pretty obvious it is very successful and has stood the test of time.

Any further thoughts and insights are most welcome and appreciated.

So you can still reverse engineer the .so binary to attempt to learn more about the algorithm and see if you can forge validation tokens. See the below softwares:

https://ghidra-sre.org

https://www.hex-rays.com/products/ida/

Both are very strong pieces of decompilation software, able to convert machine code (ASM) into human readable C++ for reverse engineering. It increases the difficulty of RE, but it's not impossible.

As for how they did that? Code signing can be used to verify the integrity of the code before execution. But all a .so is is a Linux shared object that was compiled from C/C++ code. So if you want to make it difficult for attackers to learn more about your model, you can if you so choose, write the algorithm in C++ and then link it as a shared object to the app, and then import/use its functions in your android project. That will provide a layer of abstraction between the app and the validation algorithm.


Could a stolen certificate show as trusted? I have recently started learning about PKI and have the following question/s.

As far as I know a signed certificate contains the domain name of the server that the certificate will be placed upon.

If I were to change the 'hosts' file of a PC and have, for example, www.youtube.com point to my own server, is it possible to 'take' Youtube's certificate and place it on that server, and have it appear as trusted?

I understand it would be pointless as an attack as you don't have the corresponding private key to decrypt the data, but to the end user, would the website appear as 'trusted' in their browser, as the domain is still correct?

The signature would also be valid I believe, as you haven't modified the certificate in anyway and therefore the hash would remain the same and the signature valid.

Would the above work? would the user send encrypted data to the fake 'www.youtube.com', but then nothing happen as the server hasn't got the key to decrypt it?

Any help clearing up the above questions would be greatly appreciated,
Thanks.

Edit - I now know it will show as untrusted as a SSL/TLS session cannot be created, but as a follow up question -

On Chrome when I visit a HTTPS site, click the padlock, and then 'Connection'. There are 2 parts, identity and connection. I wonder if the top 'identity' part would show as green and trusted, but the bottom half would show as red because it can't establish a connection, for the reason mti2935 answered?

No, the certificate would not appear as trusted in the user's browser, because the connection would fail, because the user's browser would not be able to complete an SSL/TLS handshake with the server. In order for the handshake to be completed, the server must have the private key that corresponds to the public key in the certificate.


external logins having to confirm email i allow members to sign up/ login in using external logins (social networks and such), the problem is that, if i didn't ask them to confirm their emails then how would i validate their ownership to this email (assuming the social account wasn't theirs) which then will mark my mail as spam

second, for security purposes, i force users that wish to change their email before confirmation or resend the confirmation to same email to enter their password, which wouldn't exist in the case of external login unless i ask for it (which is forcing the user to do extra steps)

so it's being completely secure with extra way to login other than the social network account vs convenience and ease of the signing up process, so which should i use, or should i let the user decide, but would it matter from a security perspective?

Principle: "Excessive" security measures make users search for ways to bypass security, thus defeating the purpose.

From my experience of implementing similar systems - and the logic we used to design them:

The idea of federated authentication is to "depend" on the identity provider to do the ground work for certain properties of the identity - so that you don't have to. If you are using Google/FB/LinkedIn or similar social media logins, this is a basic premise.
The key here is that you make sure that the identity provider's processes are indeed verifying the property (attribute) they are asserting.
So in general (i.e., unless your threat model indicates an exception) - you don't need to further verify an email address (which is among the most basic identity attributes).

** You mentioned "assuming the social account wasn't theirs": For most applications, I'd say this isn't a threat scenario that the app designer needs to cover for.
All in all, asking email to be verified again after a federated auth appears to a bit of excessive precaution hurting the security cause more than helping it.

There are several recommended password reset flows

a notable one that I remember is by Troy Hunt - here: https://www.troyhunt.com/everything-you-ever-wanted-to-know/
my favorite is by Jim Manico (OWASP / Manicode.net); the last bit of this doc (forgot password workflow) should help: http://docplayer.net/11058445-Authentication-and-session-management-jim-manico-secure-coding-instructor-www-manicode-com.html

Though it's not explicitly stated in either of the above, the need for a password reset through a registered email doesn't increase the need for additional verification at step 1.

Summary: Unless your app has a specific threat, email from a reputed identity provider's authentication flow should be sufficient without further verification.


Is asking for password before asking for email/username more secure? When I - and many others - login on a webpage or someone else, I type: <email or username> [tab] <password> [enter].

In case of making a specific typing error - not pressing [tab], the password is displayed in clear text in the email/username field. This has happened to me a few times, and I think I'm not the first one.

If you would switch the email/username and password fields, this problem wouldn't occur. However, people not noticing the switch may type their password in the username field, which is what you wanted to prevent in the first place. Besides I think the switch can lead to confusion to the user because it 'looks weird'.

My question is, is switching the email/username and password fields worth it?

Answer

People are creatures of habit and have become accustom to the standard login page by now. (i.e., username then password). Changing this flow would undoubtedly create a UX nightmare and may ultimately cause the application it's protecting to receive unfair criticism based solely on the login page.

Alternatives

A better approach would be to not set automatic focus in the username field so that the user has to manually click into the username field, thus increasing his/her awareness of their actions.

Alternatively, if you wanted to do some lightweight testing of your theory, consider setting the focus.onLoad() (I'm pseudo-coding here) to the password field. As a third option, consider hiding the characters of the username as well.


Debugging self recreating files While cleaning up a portable HD I came across a directory that I cannot delete with the error that it is not empty, and that despite trying to delete it with the -rf flags (I am running linux).

I went in the directory and found 3 hidden files titled:

.fuse_hidden00000e6f0000002f
.fuse_hidden00000e8500000030
.fuse_hidden00000eb200000031

And upon deleting them they were instantly recreated, exactly the same by their checksums only with slightly different names (the last 2 characters advanced by 1 in hex).

Opening them with a hex editor I found mostly gibberish and some readable strings of files that might have been in the same directory before.

I tried to put a watch on that directory with auditctl but in the logs I only see my command for deleting them, but not the one recreating the new ones.

Any ideas on how to continue from here? Mainly on how to find which process is recreating them?

.fuse_hiddenXXXX files are explained here on askubuntu.com

You can safely ignore .fuse_hiddenXXXX files. It means a file was deleted but there is at least one software which is still using it, so it can't be removed permanently.
It will be done automatically when the relevant software stops using the file or exists. Such files are always gone after umount/reboot. This is how Linux and any Unix works but only FUSE exposes these files to the user.
These files are also related to the ntfs-3g file system.

You can find out what application has the file open by using the lsof command.
lsof /full/path/name
-OR-
lsof /relative/directory/path/name


How to know what's the type of an attack and from whom is sent? I'm currently running a game server on a dedicated Windows 7 machine and it is being attacked.

How do I know what kind of attack it is and from whom is sent?

When he attacks, the RDP freezes and the server doesn't respond.

I've tried different methods of protecting the server with firewall rules and nod32 firewall but nothing worked.

The short answer is that you need more data. You need firewall and server logs to determine what happened at the time of the event. You can also run a packet capture and analyze the pure traffic for anomalies (use Wireshark for packet captures, Snort for IDS, etc).


Is there any way to differentiate between a normal web request and a web service request? I have a security layer for providing the security of the requests that come to my server. For all web request that come in a login page is shown if cookie is not present. I am now introducing web service requests to this server which also look like normal web requests. Is there any way to differentiate these requests at the security layer so as to route them to different security implementations.

Both the web requests and web service requests come in as basic http requests.

I guess the key question is how is your web service secured?  If you are using an http connection for a web service, then it will need some pretty heavy security on the requests and responses itself (such as a signed incrementing HMAC) to validate message integrity.  Either way, the best bet is probably to look at the structure of the request itself.

It's really hard to give you a good answer without understanding more about how you are capable of handling routing the traffic though.  It could be as simple as setting up two different sites, one to handle the web requests and one to handle the web service.  Then each site could have different rules assigned.  If you are using a hardware device on the front end, then it would depend on the capabilities of that device.


Change Server IP used by Executeable [Client-Server Authentication] for Authentication of my Executeable i use a TCP Server Module running on a VPS my Client(Executeable) connects to. Therefor i have to have the IP of the VPS inside the Executeable. I have two major problems with this:
1. If someone somehow gets hold of the source or disassembles the Executeable(i do have obfuscation, but if he somehow manages to) he would have the IP.
2. If the Server goes down (maybe due to being DDOSed after someone obtained the IP inside the Executeable), how should the program know to which server it should connect, without me pushing an updated version of the Executeable.

To solve this i thought about having another server which distributes the IPs, but then there would be an IP/Address in the Executeable again and they could just put down the distributing server and we are back at Problem #2.
I don't know if you guys get what i mean, but i would love some advise or ways i could atleast make this more efficient.

Instead of using a static IP address in the executable why not use a domain. This way in the case of needing to change the IP address you can just change the IP address that your domain name points to.

This will prevent you from needing to patch the executable in the case the IP address needs to change. Of course it is still possible for an attacker to DDoS the new IP so you'll still need some way to mitigate the effects of an attack like this.


Router D-Link 600 B1 EDB-ID-15666 Vulnerability I would like to ask how to update my router firmware at D-Link 600 B1. The problem is I download the newest firmware update in .bin file and when I plug in to my router and try to update this firmware, the router says that this file is not recognisible so I can't update firmware.

My router was hacked by some hackers. I know this because Avast after scan detected EDB-ID-15666 Vulnerability hole, and my network statistics showed some huge traffic despite I wasn't doing anything on PC.

I post here screenshot from this scan:

Is total reset to production setup a only way to fix that ?

Thanks in advance for help :-).

The router may still be communicating with the hacker's computer, and thwarting your attempts to repair it.  Try bypassing the malware by downloading the router's update file from a different network, such as a coffee shop, and save it. When you get home, disconnect your D-link from the internet, do a 'factory reset', reboot it, and then try uploading the new image to it.


What's an attack's 'computational complexity'? I'm writing a business-language report about MD5. In my search a found a paper by Yu Sasaki and Kazumaro Aoki explaining their 2123.4 pre-image attack on MD5.

I know that it has something to do with the feasibility (or in some cases, even the possibility) of an attack, but I don't have a sound understanding of what computational complexity exactly is .

So, what's computational complexity in that context? And at which limit we can say this attack not feasible or this attack is not possible?

"Computational complexity" is a measure of the CPU / RAM effort involved in the execution of an algorithm. In the case of an attack over a cryptographic algorithm (e.g. MD5), complexity is measured relatively to the attacked algorithm. MD5 processes data by 512-bit chunks, so it has an "elementary cost" which is the amount of CPU it takes to hash a small message (of 0 to 447 bits, to be precise). Since MD5 offers a 128-bit output, so, for a preimage attack (finding m such that MD5(m) = x, where x is given), the generic "get lucky" attack has average cost 2128 times the cost of hashing a small message. Indeed, the "get lucky" attack is about choosing random m until a match is found, which, for a "perfect" hash function (a random oracle) works with probability 2-128 for each try.

Therefore, we express "CPU effort" as the number of times the attacked function could be evaluated with that many invested clock cycles. This measuring unit has the nice property of easily showing whether a function is "academically broken" or not. The "get lucky" attack is generic: it works for every hash function, regardless of its perfection. The average cost of that attack is 2n for a hash function with a n-bit output. So any attack which does better, even slightly, counts as a "break". In the case of MD5, the presented attack has cost 2123.4, which means that it is about 20 times faster than the "get lucky" attack. But it still completely infeasible in practice. Realistic limit for a powerful attacker (say, someone with the budget of Google) is around 280 invocations of MD5.


Hadoop security, isolation, and hardening This is a multiple part question, which all really come back to the main question:

  How best to protect data in a Hadoop (wikipedia) cluster.

(Current version, vanilla main-branch distro - though I'm open to hearing about others).
After much searching and researching, I have not come up with an awful lot...

My scenario is a service provider, that hosts and process large amounts of data from several big corporate customers (multi-tenancy). These customers do not access the Hadoop directly, but only through the SaaS application. However, these customers are often direct competitors, and often quite paranoid (justifiably, since each would probably be happy about some corporate espionage against the others....).

My old-school, knee-jerk reaction is to deploy individual, isolated instances for each customer. However, this is not practical, nor does it allow to take advantage of Hadoop's benefits and capabilities.
Also, I find it hard to believe that with all the big users of Hadoop, there are no good solutions for these issues...

Particularly, I'm looking at these issues:

Limiting access to the specific users in use by each application (application user per customer)
Encryption
Isolation between customers, i.e. not allowing one customer to view another's.
General hardening recommendations

I've managed to come up with a few directions, but haven't been able to verify that these are good directions, or if there are better solutions.

Service level authorization
Network/system isolation, to prevent anyone but the application from direct access
File / folder permissions, per application user (i.e. customer).
Problems I've found with this approach:

Permissions are only applied at the NameNode; direct access to DataNodes would still provide access.
Authentication is a bit "iffy", at least until they add in Kerberos support (after that, we'll have to see re implemenation...)
It seems to me that this doesnt provide enough isolation between customers.

HDFS Federation / Namespaces
This might be able to provide better isolation of privileges, not to mention seperate servers and allocated bandwidth per customer (to prevent one trying to DoS another via the NameNode single point of failure). But I haven't found any real information on real-wrold usage, or how it stands up to misuse.
Also, this doesnt solve the issue of soft authentication (does it?), and direct DataNode block access (does it?)
For data encryption, I'm torn between HDFS encryption (a single, symmetric key shared between ALL Nodes), or application-level encryption (and the key (or keys, say one per customer) would still need to be distributed to each Task Node for MapReduce jobs).

It really depends on who you're trying to protect your data from.

I have set up Hadoop clusters that use eCryptfs on each node, to ensure that data can be transparently shared between nodes, but also ensure that all data is encrypted before being written to disk.  This provides a measurable level of privacy and protection, if you're trying to secure data from being vulnerable to physical theft of disks or remote network storage underlying virtual machines in a cloud environment.

Full disclosure: I'm one of the authors, and the current maintainer of
eCryptfs userspace utilities.


Upgrading to latest software version for security reasons I have some software that I want to upgrade to improve security. The current version I'm on is 2.6.2. Is it better to upgrade to the latest version of the entire product line which is 2.8 or should I upgrade to the latest version of my current product which is 2.6.7?

There is no absolute, consensual and systematic convention for versioning. Every vendor numbers his successive product versions as he sees fit. I mean, even Microsoft decided that the next version after "2000" was "XP", followed by "Vista", then "7", then "2008". I do not know what logic this follows, but I doubt it is from Earth.

Usually, vendors try to adhere to a scheme where products have releases (each new release possibly making some substantial changes with regards to the previous release) and releases have sub-versions which are limited to bugfixes, including (most importantly) security fixes. Hence, my wild guess is that upgrade to version "2.6.7" of your software should fix security issues which are known to impact version "2.6.2" (if there are any), but not bring any new feature, and should (hopefully) be easy to apply. On the other hand, upgrading to version "2.8" is switching to a new product line, with new features, and this may break compatibility with the rest of your system, which has been configured to talk with version 2.6.

Note that some vendors of widespread software do not follow such a scheme. In particular, Web browser vendors (in the case of, at least, Firefox and Chrome) tend to follow the simpler scheme known as "use the latest version or die". Version numbers are then meaningless integers whose only merit is to be bigger than the version number of the competitors (fortunately, there is no shortage of natural integers).

But you really should see what the vendor documents about his versioning system, since each vendor has his own conventions. As @RoryAlsop explains, this documentation can take several forms, including changelogs; and, of course, testing is paramount: don't upgrade any critical system until you have some good indications that the new version actually does the job...


How realistic is it to spoof a specific UDP IP address? Let's say that I'm a malicious user Bob and I have found a vulnerability in an application that will allow me to impersonate another user, Alice. Alice is connected to 'X' server with her IP address (1.2.3.4) and local port (1234).

Through some means, I have managed to obtain both Alice's IP address and the local socket she is connected through (1.2.3.4:1234). Given this information, how feasible is it to construct a spoofed UDP packet and have it be successfully routed to server 'X', without it being dropped?

An important thing to note here is that you are not strictly connected to a server with UDP in the same way as TCP, as UDP involves no handshake process. That said, there could be some sort of handshake included into the server's own logic.

As suggested by commenters in this question some ISPs, switches and routing devices do feature source checking so while it is definitely theoretically possible, your actual mileage may vary.


Is there any history of a major attack using password reuse? While everyone and their favorite webcomic seems to agree that password reuse is a major problem, some quick googling cannot seem to find any cases where it has been used on a large scale in an attack. Thus I ask, has there actually been any occurrences of a large-scale breach made possible by password reuse? If not, why hasn't there been any?

The attack against HBGary is a famous example of an attack made easier by password reuse:

  Neither Aaron nor Ted followed best practices. Instead, they used the same password in a whole bunch of different places, including e-mail, Twitter accounts, and LinkedIn. For both men, the passwords allowed retrieval of e-mail. However, that was not all they revealed. Let's start with Ted's password first. ... his ssh password was identical to the cracked password he used in the CMS. This gave the hackers immediate access to the support machine.

I don't know if you consider this attack large-scale, but it was definitely large impact to compromise a famous security firm, publish its internal emails etc.


CSRF tokens in Single Page Applications (JavaScript/Angular) I have an AngularJS SPA served by Apache on a cheap web host.
All communication to the backend is via Ajax REST calls to an expensive cloud server running Tomcat.
How can the REST calls be protected from CSRF given that the frontend and backend are hosted on different servers?

Basically the Apache server needs to issue CSRF tokens and the Tomcat server be able to recognize them. Assume they are under the same domain.

In order to implement CSRF protection, you need a token that is secret in the sense that it can't be calculated by an attacker. You can use a modification of the encrypted token pattern from the OWASP CSRF cheat sheet.

You can either use a shared secret key between the front-end and back-end or a public/private key, storing the public key on the front-end and the private-key on the back-end. You then encrypt the user ID and timestamp on the front-end to use as your CSRF token and verify it on the back-end. Instead of encryption you can sign the data using an HMAC or a digital signature. All of the options (asymmetric encryption, symmetric encryption, HMAC, and digital signatures) will produce the desired token properties of being easy to verify but effectively impossible to predict.

The OWASP document suggests that you encrypt the user id, timestamp, and a nonce, but I believe that the nonce is unneeded. See this question and the comment on the OWASP discussion page for more information.


How secure is blocking all incoming connections on my ADSL or cable router? My router, an up-to-date ADSL Fritz!Box 7340 router with a fixed leased IP address, has been configured to block all incoming traffic.

Assuming, for the sake of argument, no extra security is applied to the home network and the machines are unattended and wireless is disabled, how secure is this "block all" configuration against some hacker that tries to knock on my door?

I know that each OS and every single software program has its flaws and can be attacked, but when nobody gets in, they can never get to the flawed software, right?

Using this statefull firewall should stop a large amount of unwanted connections.

Statefull firewalls are not completely impenetrable, it is possible to force a user to initiate a connection using embedded javascript within a webpage. Once connection outbound has been made it could be possible for the server to respond and deliver their payload.

The Register - Hacker pierces hardware firewalls with web page

The link above gives a greater detailed example regarding exploit via the IRC protocol but the theory should be possible on a wider scale.


MariaDB SQL Injection vulnerability? I'm testing for SQL Injection on a website.

Basically, I'm trying it in the following url:

http://example.org/webpage/*

where in place of the * the payload should be injected. When I try to put in there this: ' OR 1=1/*, the url will be so: http://example.org/webpage/'%20OR%201=1/*- this is the output:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '/*', 'IT', 'name=\' OR 1=1/*', 1499954730)' at line 1

Does this mean it's SQL-injection vulnerable? If yes, how can I try to exploit it with sqlmap? This is what I tried running:

$ sqlmap -u "http://example.org/webpage/*"
 but it says there is nothing injectable, and I highly think it failed.

I could be wrong, but I'm fairly certain that your main problem is that you are attempting to do mysql injection wrong.  As a general rule of thumb, if a payload can trigger an SQL syntax error then your attempts at preventing SQL Injection are not really working.  For instance, if you were using prepared queries, there is no way for the payload to result in an SQL syntax error at all.

In this particular case the problem is that you are using the wrong kind of comment to hide the rest of the command.  In this case you would probably have more luck (making SQL Injection happen) if you used a double dash (--) or pound sign (#) which both start single-line comments in MariaDB.  The comment character you are using (/*) is a multi-line comment character that has no closing comment character.  This appears to be the source of the SQL error.  While I'm not personally familiar with sqlmap, my suspicion is that it may not think there is an injection vulnerability, not because you are safe, but simply because your injection payload is generating an SQL error, and therefore no injection is happening.  Try again with the proper comment character.

To reiterate, the fact that you getting an SQL error makes me think that you are vulnerable to SQL injection, you just aren't doing the SQL injection properly.

Edit

I think your next step is to ignore sqlmap for a bit.  The attack you are doing ' OR 1=1 would select all records.  Your URL implies that this is a view kind of page, which shows only one record at a time.  As a result, there are many cases where such an SQL injection payload may not actually have any results on the page in question.  This is the part that can make it tricky: SQL injection is only "successful" if you can actually do something with the attack and impact the application in a meaningful way.  So for instance if your payload causes it to load all records in the SQL command, but the page in question implicitly shows only the first result (because it is a view-type page), then you won't realize that your injection has been successful.

The short of it is that your given SQL injection payload is context-specific, and may not work in all places on a given website even if the page is vulnerable to SQL injection.  That makes SQL injection extra tricky.  Some sql injection tools can automate some of that trickiness, but I don't know if sqlmap is such a tool.

So ditch sqlmap for a moment.  Try a different kind of payload.  Instead of selecting ' OR 1=1 try doing ' AND 1=0.  This should (theoretically) result in zero records.  So if you get a 404 (or nor results in general), I would consider that evidence that the page is vulnerable to SQL injection.

Of course, if you're feeling mean you could just try variants on '; DROP TABLE users-- until something breaks :)  That would be mean though.


Security Certificate not from a valid authority I have no real knowledge about this stuff so I figured I'd ask here for some answers.

So I started to get this "Security Certificate not issued by a valid authority"  error when using my email client yesterday when attempting to connect to the STMP server of my ISP.  I haven't changed anything in my Android phone or my desktop and both are giving me this grief.

When I look at the certificate details it says its from VeriSign but doesn't seem to be authentic.

What causes this error?  What should I do besides complain to my ISP about it?

I was asked for additional info so I manually copied it over you.

My ISP is saying that 90% of the time its time stamp problems and I should check my time on my end...its a friggin' cell phone that gets its time from the network so I can't see that as being the issue.

I was having this issue with both my desktop and my phone, now the desktop works again but the phone is still giving error messages.

  This certificate is not from a trusted authority.

  Issued to:

  Common name: mail.shaw.ca

  Organization: Shaw Cablesystems G.P.

  Organizational unit: Engineering

  Issued by:

  Common name: VeriSign 3 Secure Server CA -G3

  Organization: VeriSign, Inc.

  Organizational unit: VeriSign Trust Network

  Validity:

  Issued on: 2013-11-11 16:00:00-0800

  Expires on: 2014-11-19 15:59:59-0800

You could try to access the link from a browser and check the certificate details( like in firefox: Edit -> Preferences -> Advanced -> View Certificates ).
Enusre that various fields like issue to and dates are correct.
Please post the details if that is feasible.Also which email client are you using ?

Since "Security Certificate not issued by a valid authority" is exactly what it means and there are no changes done on your part, go ahead and mail to your ISP already.


Securing apache by IP with .htaccess I have a folder that I don't want to be accessible from outside my network's LAN. It seems like all traffic from the outside world goes through my firewall (192.168.1.39). So I made my .htaccess as follows:

Order Allow,Deny
Allow from all
Deny from 192.168.1.39

My thinking is that it allows all traffic, except for traffic that is redirected by my firewall: ie all external traffic.

Is there anything I'm missing? Any way for a hacker to bypass the firewall to get at the server directly? Any way to use IP spoofing to get around the .htaccess? etc?

EDIT: I can't allow from the local LAN with either a subnet or domain, because the external traffic looks like it is coming from the local LAN. It is being redirected from my firewall, a forigate inside the network.

You should specifically allow the IP address(es) that is allowed to access the resource and Deny everything else.

order deny,allow
deny from all
allow from [your ip address] OR Allow from 10.0.0.0/24

Depending on your network configuration, requests to the server from the internet may include public IP addresses. Routers typically only provide NAT from the LAN network to the WAN network, not the other way around.


Is access to the caller API in mobile phones a real security threat? From time-to-time I receive "Unknown" caller on my mobile phone. I do not want to answer those calls as I do not trust the identity of a caller. I feel safer if I can see caller name or at least caller phone number.

I do realise that some businesses mask their identity, so they do not receive many return calls from potentially angry customers. However, I don't care.

For emails, we have effective spam-catching filters that often sit on the recipient side. For mobile phone calls there is no effective similar system available (for example registering with a government backed Do-Not-Call web sites, like this one in UK does not help me). I feel a more robust system will block/mute/ ignore/choose-your-action such calls on the receiving end.

Problem: Windows phone OS does not expose caller API, possibly due to security concern. Sources: SO question, forum post, not implemented feature request.

Questions: Is there any valid security concern that forces OS vendors to block access to the caller API for the developers? Is there any way to stay safe and secure, but also allow caller API be available for developers (so they can develop legit blocking apps)?

In general, OS vendors implement what network provider wish to see, and network providers are very wary about interfacing the bits which do the actual phoning, with user-provided code. They don't want customers refusing to pay their bills and defending themselves by saying that they did not pass the calls, but some virus on their phone did. Such a defence would have some non-negligible chance of success in court. There's big money at stake here, so caution is applied. "Caution" meaning here keeping as much internal separation as is possible. Not making the caller API available to application seems to participate to this general separation principle.


How to publish scanned documents anonymously? I was thinking of the following question for a long time and did not find a lot of material* in the web and nothing at all on Security.SE.

I think its a very interesting question as it covers different anonymization measures (or counter measures to possible deanonymization measures of soft- & hardware) and within the modern times seems to be more important than ever to protect the human right of freedom of speech.

How can I publish (scanned) documents anonymously?

To narrow down the question a little bit, lets define some parameters:

I have some documents in paper form I want to publish without identifying me as the publisher.
These documents have no "fingerprint" or any unique printed information on them to identify me as the owner. (Or I have covered it)
I will publish the digital files via a secure network (e.g. Tor) with an open source file hosting website that is guaranteed to not store or even publish any information about the uploader.

Things I thought of that might be a problem:

Do scanners add any visual unique fingerprint (or even worse: information about the connected device etc.) to every scanned page?
Do scanners add any digital (e.g. binary) fingerprint (or even worse: information about the connected device etc.) to every scanned file?
Do scanners have a unique 'technical unavoidable' fingerprint, so every scanner scans differently? And is this fingerprint computable or even stored somewhere? Or does the  'institution' that wants to deanonymize me have to have access to my scanner to make an comparison?
Do PDFs 'store' any information related to the host computer in them?

And if the answer to one of the question was yes, how can I remove or avoid this information?

*Two notable Sources I have found:

There is a small paragraph on WikiLeaks talking about unique
fingerprints of CDs but not of Scanner output or PDFs...
A paper from Purdue University about scanner & printer forensics

Publishing scans without being identified is a tough proposition. There are multiple risks of information leak, and mitigation is technically complex.  However, anyone determined to do so can learn the appropriate techniques, and there is free software to accomplish the task.
Disclaimer: Although I consider myself technically knowledgeable about the mentioned issues and I've included references where they exist, some parts of this answer are speculative.

Risks:

Do scanners add any visual unique fingerprint (or even worse:
information about the connected device etc.) to every scanned page?

This seems likely, considering that some printers do so. There isn't much information available on scanners, though.

Do scanners add any digital (e.g. binary) fingerprint (or even worse:
information about the connected device etc.) to every scanned file?

If you're doing a scan from an attached PC (as your question implies), the answer is  no, the scanner can't. Scanners attached to a PC transfer raster image data, not files, so it can't possibly add data to a file it doesn't have access to.
However, you should consider that a digital fingerprint could be added on the scanning software of the PC.
Also, if the scanner is standalone (it saves files to a USB drive, or sends them by email), this is a definite possibility.

Do scanners have a unique 'technical unavoidable' fingerprint, so every scanner scans differently? And is this fingerprint computable or even stored somewhere?
Or does the 'institution' that wants to deanonymize me have to have access to my scanner to make an comparison?

Yes. Most modern scanners use CCD sensors, which are uniquely identifiable by their noise pattern, using specialized software.
Other plausible visual fingerprinting targets:

Lighting pattern. Usually the scanner sensor bar has LEDs on it to illuminate the page. The number and distribution of leds will differ amongst models.
the  paper fiber distribution of the scanned page
image distortion, caused by unique stepper motors (try scanning a piece of graphing paper)

Using these kind of fingerprinting techniques, it seems likely that the scanner model and paper type can be identified from the scans, but identifying the specific scanner and paper page used would be hard (perhaps impossible) without access to them for comparison purposes.

Do PDFs 'store' any information related to the host computer in them?

Yes, there's even a NSA article about it. While dealing with scanned documents, you'll need to be aware of image file metadata, which can also be present on PNG and JPG files, for example.
Another risk that you didn't mention is that the scanner itself may store a copy of your scan. Big printers do
Of course, this isn't a exhaustive list of risks - merely what has come to my mind in the couple of minutes it has taken me to write this answer. I'm pretty sure researchers, intelligence agencies and police paid to do so can come up with better ideas!

Mitigation
The easiest, safest and obvious mitigations are don't use a scanner that can be tied to your identity, and destroy the scanner after the fact. Of course, this is not always attainable, so what else can you do to protect yourself?
Don't use a stand-alone scanner - especially a networked one. If you really must, convert its output to a pure image without metadata.
For (at least partially) mitigating fingerprints added by software, you'll want to use open source software, both for the OS and the scanning program.. Avoid using your personal PC for scanning, or at least, use a secure live OS
For detecting deliberate visual fingerprinting, the best option would be to scan a blank page and look for obvious anomalies. These might be very small, so you may want to use a image editor to crank up the contrast.
For sensor, paper and visual fingerprinting in general, you want to destroy subtle scanning artifacts. Use a image editor to:

Add noise
Use a noise reduction filter (with aggressive reduction)
Rotate
Distort the image (by applying multiple camera "lens correction", for example)
Convert the image to grayscale
increase the contrast (or, preferably, completely convert to black-and-white)
Reduce resolution (preferably by a near-to-irrational factor)
Compress the image (high JPEG compression, for example)

In general, do everything you can to obfuscate and reduce the amount of information contained in the image while keeping the document reasonably readable.
Finally, after all the other steps, remove the medatadata from your files. You can use specialized software to do this.


Can the user get the private key from the encrypted and the decrypted data? Can the user get the private key from the encrypted and the plaintext data or does it make it easier for an attacker?

No, that would make no sense.
If a person could get the private key from encrypted data, that would be akin to locking something and leaving the key in the lock. Likewise, the decrypted message is the same - bit for bit - as the message before any encryption took place. Therefore, the message has no relation to the private key at all.
A few more details
There are several attacks on RSA that could allow an attacker to recover the private key, such as the low exponent attack. These attacks are mitigated by using proper parameters for RSA. This should be seen as "if RSA is used incorrectly, an attacker can calculate the private key". It is not a "feature" of the encryption algorithm, nor is it something that is easily done with some openssl command.


Is This A Hack/Malware/Breach? Browser alerts about a download with a URL:

mapuser?providerid={number}&userid={longcapitalstring} ({number} bytes)

It gives me the option to save.  This looks incredibly suspicious, but it also looks like some type of tracker since both providerid and userid look like identifiers of some type.

Is this a possible malware, virus or other potentially harmful file?

Thanks to all; I had to hunt this down, but I found the URL domain origin:

  usync.nexage.com

That's all it provides.  usync.nexage.com and then mapuser?providerid={number}&userid={longcapitalstring}. I get a 404.  This also look suspicious because it appears to look like USNYC, but it's actually misspelled, which is a common technique in compromise.

After digging a bit, I found the same url mentioned in another mentioned on another StackOverflow question that match OP's description :
http://ums.adtechjp.com/mapuser?providerid=1074;userid=AapfqIzytwl7ks8AA_qiU_BNUs8AAAFYqnZh4Q

So your link might be from an adtech{countrycode}.com domain. According to Wikipedia :

Adtech AG is a German–American digital marketing company that retails products to manage, serve and evaluate online advertising campaigns (including display, video and mobile formats). The company was founded in 1998 in Frankfurt, Germany, and was acquired by AOL on May 15, 2007.
Adtech provides an integrated ad serving platform. This product allows publishers, advertisers, agencies and ad networks the ability to manage their display, video and mobile digital advertising campaigns.
Adtech's ad server responds to banner requests, prompted by user’s browsers, through XML and delivers it to the specified end system — the only provision being the terminals must be online.

So, my theory is that your browser alerted you about the said url because :

The domain is extremely shady.

Depending of the individual/company behind the link itself, it might actually be a spyware like this one.

Now that's kind of a blind shot, as OP didn't mentioned what kind of file was downloaded but well, it's an ad network, so there's clearly no reason to download nor to open the said file.


Ngrep through router I want to know if it's possible to capture net traffic through a router.

In detail:

I'm connected to a local router, which is connected to another router, i want to capture the traffic in the neighborhood of that second router, something like:

me--router1--router2

And i want to know if it's possible to capture traffic from the computers connected to "router2" using NGREP. I can easily unplug router1, connect myself directly to router2 and achieve what i want, but i wanna know if it's possible to do it somehow bypassing router1 using any flag in NMAP.

Thanks in advance!

EDIT: Obviously i know router1's ip in router2 network, router1 gateway ip, etc.

ngrep can only capture packets which are seen by the network card in the sniffing system. Packets between router1 and router2 do not get send to the local network card. So you cannot ngrep these remote packets.


What is an exploitation schema in this XSS attack? Basically, I've found an XSS injection by changing the payload with the X-Forwarded-Host header, since its value is reflected in the document and is not sanitized.

An example, this is the document source:

I set the X-Forwarded-Host to foo">, and the alert immediately popups.

Does an attack schema exist behind this type of XSS?

Update:

Since to exploit this type of XSS I have to profit of the CORS implementation, I've found this:

GET /index.php HTTP/1.1
Host: example.org
Accept: */*
Accept-Language: en
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)
Connection: close
Origin: https://milkislyudxi.com

which returns this:

HTTP/1.1 401 Unauthorized
Date: Sun, 15 Oct 2017 20:30:45 GMT
Content-Type: application/json; charset=UTF-8
Content-Length: 113
Connection: close
Set-Cookie: wfvt_3441637102=59e3c57552f99; expires=Sun, 15-Oct-2017 21:00:45 GMT; Max-Age=1800; path=/; secure; HttpOnly
X-Robots-Tag: noindex
Link: <https://example.org/>; rel="https://api.w.org/"
X-Content-Type-Options: nosniff
Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages
Access-Control-Allow-Headers: Authorization, Content-Type
Access-Control-Allow-Origin: https://milkislyudxi.com
Access-Control-Allow-Methods: OPTIONS, GET, POST, PUT, PATCH, DELETE
Access-Control-Allow-Credentials: true
Vary: Origin
Strict-Transport-Security: max-age=15552000; includeSubDomains; preload
Server: cloudflare-nginx
CF-RAY: 3ae589bca9b44316-MXP

{"code":"rest_cannot_access","message":"Only authenticated users can access the REST API.","data":{"status":401}}

so, is this exploitable?

Reflected XSS from HTTP headers usually isn't exploitable. You need to trick the victim into sending a request with a malicious header, and how would you do that? You can't just craft a malicious link as you would if the reflection was from the URL. There's a risk that the only person you can own with this is yourself.

However, I still see two possibilities:

Stored XSS, i.e. if your header value is displayed to someone else. This would be the case for e.g. a log.
If, and this is a big if, the site has a CORS policy (Access-Control-Allow-Headers) allowing that header to be set, you could trick the victim to visit a site under your control that makes an XHR call to the vulnerable site.


Can play store applications be tampered with by Google? Can play store applications be tampered with by Google?

I understand that other apps are "unsigned" so you need to have applications from unknown sources turned on.

However, Google Apps are "signed" meaning the Android device sees them as genuine and from a trusted source.

Does this mean Google has some ability to tamper with the apk when it has been uploaded to the play store?

Thank you

According to the Android Developer Documentation:

  Android requires that all apps be digitally signed with a certificate. [...]
  The certificate does not need to be signed by a certificate authority.

At least in my case - multiple apps with small user base - they are all self-signed.

For self-signed Apps a third party could tamper with the APK and self-sign it again. This would be quite hard to detect for the end-user. Stock-Android does not check if the Code-Signing-Certificate is trusted.

It just validates that - for example in case of an update - it's the same developer the two APKs come from:

  If you publish an app to Google Play and then lose the key with which you signed your app, you will not be able to publish any updates to your app, since you must always sign all versions of your app with the same key.

As @Noir already stated in his comment: You already trust Google - you are using Android - so they already have all possibilities.


How is time-based SQL injection different from other types of SQL injection? I understand what a time-based SQL injection is, and I understand how it works (at least how it's detected/exploited).

However, is there anything in specific which makes this type of injection any different to say boolean-based blind injection?

What I'm saying is if you take the following code:

<?php
$x = 'admin" AND SLEEP(10)#';
$y = 'superSecretPassword';
$query = sprintf('SELECT * FROM users WHERE username="%s" AND password="%s"', $x, $y);
echo $query;
?>

which results in the following output:

SELECT * FROM users WHERE username="admin" AND SLEEP(10)#" AND password="superSecretPassword"

That is vulnerable to almost every form of SQLi.

I guess my questions are:

a) Why would you chose to perform a time-based SQL injection over any other method of injection as Time-Based takes so long and is arguably more detectable than other methods?

b) (Running SQLMap or similar tools in this case) How is it that other methods fail, but time-based SQL injection is present?

It is not different in value from "regular" Blind SQL Injection, it's just different in manner of exploit.

The only real reason for going time-based (other than learning, of course), is if the other types of SQLi are not available.
Same reason you would bother with "regular" Blind SQLi, instead of regular SQLi.

"Regular" blind SQLi is dependant on getting back some value, even if it is only one bit different. It is easy to imagine a scenario where ZERO bits leak out directly, e.g. an application that scrubs the response, returns a single static response no matter what occurs in the database.

In such a situation, Blind SQLi would not help. So, you are forced to get back that single bit of information in other ways - i.e. time delay.
Now, the rest of the Blind SQLi techniques can step in, based on this one indirect bit of information.

So to answer your direct questions in reverse order:

  b) How is it that other methods fail, but Time-Based SQLi is present?

Because the application does not return even a single bit of information directly, even though it is injectable.

  a) Why would you chose to perform a Time-Based SQLi over any other method of injection as Time-Based takes so long and is arguably more detectible than other methods?

Because (b).


Do non-administrator Windows accounts need strong passwords? I have always used long passphrases for my own Windows user accounts. But I know some people who use moderately common passwords (we'll say they're in the top 1,000 most used passwords, but not in the top 100).

From Why do we lock our computers?, I see that locking protects you from attackers who are unskilled or not prepared, and can even slow down prepared attackers for a few minutes. But if a capable attacker is alone with your computer for any extended period of time, they can get in if you don't have full-disk encryption.

Does it make sense to use a strong account password (that is, something not in any password list)? Nobody is going to try the top 1,000 passwords if they're alone with your computer for a few minutes, and if they're with your computer for longer than that they can use other means.

Suppose RDP is disabled on the computer and the administrator account has a lengthy, unique passphrase. We'll also suppose that the user's password is not one they use elsewhere. Is there any attack that becomes easier if a non-administrator user password is in a list of common passwords?

Here's the thing: If you're not using full-disk encryption, an attacker can boot from a live OS and plant malware in less than ~2 minutes on any account. Even the administrator account! If encryption is not enabled, a strong admin password does nothing.

So full-disk encryption should always be used.

However, it's good practice in general to always use long and strong passwords. Users should be in the habit of doing this. The layperson doesn't understand much of how computer security works. They don't know or care whether or not a computer is encrypted. But if they're in the habit of using longer passwords, this makes their systems more secure the moment that encryption is enabled.

If full-disk encryption is enabled, the password length/strength will determine how long it takes an attacker to decrypt data.

Also, using a longer or more complicated password makes it harder for someone to stand over your shoulder and just take note of your password as you're typing it in. You'd be surprised at just how many times this simple attack is successful in corporate environments.

Also,

  Nobody is going to try the top 1,000 passwords if they're alone with your computer for a few minutes

Ever heard of ophcrack? If you use one of the top 1000 most used passwords, it can be cracked within seconds. However, this attack can also be mitigated by using full-disk encryption.

If full-disk encryption is not used, using a stronger password prevents only the attacks that require the least amount of skill, such as ophcrack, wherein a script kiddie basically only has to boot from a disk and it'll do the rest by itself. The system still remains vulnerable to many other attacks, such as the one which uses a live OS.

Edit: As OP very correctly points out, having a strong admin password on an unencrypted PC only helps in case an attacker has gained remote access to a non-admin account, which makes privilege escalation attacks harder, and any unauthorized access to data or planted malware remains limited to the single non-admin account that was compromised.


Question about IPv6, NAT, firewall, port forwarding, upnp and security In the next months/years my ISP might give me IPv6 for my home connection. But what are the security implications? Will local network servers/embedded devices be accessible from the whole internet?

In IPv4 you were protected by the NAT. Many services and embedded devices like network printers have a local adress but listen to any incoming connection (0.0.0.0 at IPv4). If they should be reachable from the internet, port forwarding or upnp were your options (including some infamous security cameras beeing accessible via upnp without password by default from the internet).

When my ISP switches me to IPv6 are those accessible from the internet/do I need to create firewall rules on my home router (similar to port forwarding)/will there be something like UPnP for programms like bittorrent? Are there other security considerations? Will it end like this https://serverfault.com/questions/766890/network-printer-exploited-read-hacked-to-print-antisemitic-documents-how-to ?

If this is model/ISP specific, feel free to assume a common configuration (preferable in central Europe).

With IPv6 you cannot rely on NAT, and thus, yes, you have to configure reasonable packet filtering rules on the router or firewall. For stateful filters this is easy to accomplish: Allow all outgoing traffic and allow all incoming traffic that is related to the outgoing traffic, drop anything else. For stateless filters there's a bit more to do, in particular, you have to bear in mind that IPv6 requires several ICMPv6 packet types for its operation (mostly error messages; for instance, "packet too big" messages since with IPv6 routers don't fragment as they do with IP legacy).

Without NAT you don't need port forwarding, you simply add the according filter rule for incoming traffic.


Internal / external Penetration testing a webserver - PCI the PCI DSS document states:

11.3.2
Perform internal penetration testing at least annually and after any significant
infrastructure or application upgrade or modification (such as an operating system
upgrade, a sub network added to the environment, or a web server added to the environment).

11.3.1
Perform external penetration testing at least annually and after any significant
infrastructure or application upgrade or modification (such as an operating system upgra
de, a sub-network added to the environment, or a web server added to the environment).

How can i perform an Internal penetration test on my webserver? is there any software that can do this? And what would this software do? if someone has access to the internal workings of the webserver then they would have access to everything?

Can anyone recommend any software that is easy to use that can do the internal / external pen testing? and would I need to upload it / send it to my hosting company?

I deleted my previous answer because I decided that it required too much overhaul.

Internal penetration testing happens within your organization to test how vulnerable you are to an inside threat. External penetration testing is done from outside the organization to test how vulnerable you are to an outside threat. In both cases, a penetration tester probes for vulnerabilities and reports on the findings. Yes there is software for this, but the software is a tool for a professional, it does not replace one.

When you host a web server and/or database with a 3rd party, the game changes. External testing can be performed that also includes application vulnerability testing (which is what my previous answer focused on). But internal testing now becomes a challenge. Some hosting companies that specialize in hosting PCI-compliant servers will perform the testing themselves and report to you on the results. If you are storing credit card details on a server hosted by a third party, you might be non-compliant if you don't have a dedicated server. Check with your hosting company to see if they handle PCI compliance.

The short answer is:

penetration testing is done by a professional
you need to work with your hosting company to get and remain compliant


How to safely extract an uploaded zip? I'm working on a project for a client where they would like their users to upload a ZIP file that can be extracted. Once extracted, we would utilise certain files in there, such as images and HTML files.

It's clear that this is a huge security risk as you cannot safely check the contents of the file. The project is currently for internal users only, but they would like to open it up to external users at a later point.

The project is currently being built with Laravel, and there are no libraries that could possibly help there. So I figure this is probably going to be more of a question regarding the server itself. But what measures could we take to prevent viruses and attacks in these zips?

Maybe you can find libraries that could help to detect harmful files. But I'm afraid that you will have to choose between being strict and having false positive, or loose with the risk of occasionaly letting malware pass.

My advice here would be to rely on traceability. You control (as much as possible) the uploaded files, but for each one keep the name or id of the user that uploaded it. And you advertise largely on that. If later a problem occur, you will be able to identify who is guilty for it. Of course it only makes sense if you know all your users. But I cannot imagine a way to secure a site accepting dynamic content for uncontrolled users ...


TLS certificate requirements Can any certificate be used for TLS?
What requirements should the certificate meet for TLS? SHA1/Sha2 {key specs} etc.

Can any certificate be used for TLS?

No. There are certificates for example for code signing, certificates which are only used to issue other certificates, ... How a certificate can be used is defined by various parts of the certificate, i.e. mainly basic constraints, key usage and extended key usage.

For some more information see  Which key usages are required by each key exchange method?, Is the Extended Key Usage extension mandatory on the web?, TLS/SSL Certificate - Key usage and encryption, Can I use a code signing certificate as a TLS certificate?, Can I use the same ssl cert to protect my web site and sign my app?.

  What requirements should the certificate meet for TLS? SHA1/Sha2 {key specs} etc.

To be wildly accepted the key usage extension should contain at least digitalSignature and keyEncipherment, extended key usage should at least contain serverAuth. Subject alternative names should match the fully qualified domain name, it should be issued directly or indirectly (via an intermediate CA certificate) by a trusted CA, key type should be RSA (better >=2048 bit) or ECC (better >=256 bit), signature algorithm SHA-256 (or better) ... - there are probably some more restrictions in some case like use of X509 extensions for certificate transparency etc. CA's usually do the right thing so just look at the certificate you get for typical web sites.


Which is better for SSL: TLS_EDH or TLS_SRP? DH is vulnerable to a man-in-middle attack due to no server authentication; and RSA does not have forward secrecy.

People suggest used Ephemeral DH but what are the differences between Ephemeral DH and ordinary DH? Why it is more suitable? How about using the secure remote password protocol for key exchange?

In summary, which of these is better, and why:

TLS_EDH or TLS_SRP

For web applications I'd go with ECDHE_RSA as preferred exchange with DHE_RSA as fallback.

ECDHE is forward secure, efficient, and gives you a high confidentiality level (128 bit using P-256). DHE is slower and has a lower security, but some browsers (such as Opera) don't support ECC.

I'd still use RSA for authentication. The security level required for authentication is lower, 1024 bit RSA is good enough when used together with ECDHE. You might want to increase it a bit beyond 1024, but that's mostly about PR, and not about actual security.

With such suites you use PKI with RSA to ensure you're talking to the right server preventing MitM, and (EC)DH for the key exchange, giving you forward secrecy.


Biometric authentication in the real world can anyone give a realistic estimation, based on real-world experience, of how much biometric authentication techniques are being used in the IT field?

As I'm sure I posted in one of the other biometric questions, the only places I see it a lot are datacentres. And more specifically, datacentres protecting high value root certs. For this type of environment it is the norm, rather than the exception. Update to say - it is only ever used in addition to all the other controls, not instead of!

Elsewhere, it's patchy - people are starting to use fingerprint scanners on laptops etc., but I get the impression that is just because they are there so might as well be used:-)


Exchange - Email Account Compromise A bit of help on this one if anyonce can, Outlook account (on exchange) seems to have been compromised, however in an automated spam kind of way, a rule is set up on the account to move items from inbox to deleted items, email is sent from the account to other accounts including itself.

An email was recieved into one account with a scam weblink, a user did submit their details however does not result in manual activity more automated.

Any ideas.

Luke

This is quite a common occurrence that I've seen elsewhere. I'm pretty sure that it generally occurs when a user has an insufficiently strong password and gets targetted though it may also happen via malware.

The attacker tries to hide what they have done by deleting the sent history.

The users account should be immediately suspended and the server logs used to find out what has been sent. All of the accounts in the users contact list and recent emails may also then get attacked or at least spammed and should also be warned.

Before re-enabling the users account, their password should be changed and their PC scanned for malware (more than just anti-virus) by someone with experience.

Don't forget to also check any other devices with access to the mail account.

I should note that, where I've most seen this is in an industry sector being actively targetted.


Gmail warns about encrypted PDF file I recently received a PDF file that, when attached to a gmail message, causes a warning to be displayed as follows:

Encrypted attachment warning – Be careful with this attachment. This message contains 1 encrypted attachment that can't be scanned for malicious content. Avoid downloading it unless you know the sender and are confident that this email is legitimate.

However, I am able to open the file without getting prompted for a password. I followed the advice given in this security stack exchange question and used the pdfid.py program whereupon I got the below output:
$ pdfid.py ~/Downloads/filename.pdf
PDFiD 0.2.7 /home/username/Downloads/filename.pdf
PDF Header: %PDF-1.6
obj                  402
endobj               402
stream               401
endstream            401
xref                   0
trailer                0
startxref              1
/Page                  0
/Encrypt               1
/ObjStm               15
/JS                    0
/JavaScript            0
/AA                    0
/OpenAction            1
/AcroForm              1
/JBIG2Decode           0
/RichMedia             0
/Launch                0
/EmbeddedFile          0
/XFA                   0
/Colors > 2^24         0

It would seem to me that since this file contains no JavaScript it is safe to open and handle. But I am puzzled by the encrypted message that Gmail displays. I guess it is related to the /Encrypt flag that's set on the above output.
Why is Gmail telling me that the file is encrypted even though I can open it without being prompted for a password and would that, on its own, be reason for concern?

Of course Google will warn about encrypted content, especially if it is not encrypted by themselves, hence they cannot decrypt the file. The warning comes only because they are not able to see the file's contents, not because there is something wrong with it. At all times they will prefer having control of all the variables: holding your password, the encryption keys and so on.
Now, this doesn't add up:

However, I am able to open the file without getting prompted for a password.

What is expected for decryption is a key (not a password), but still, you need something. If you can see the contents without the key, it is not encrypted, maybe coded but not encrypted.
As always, you should use good sense to decide about this attachment:

where it came from?
do you know who the source of the file is?
did you asked for it?


How do large corporations manage accesses guarding? I work in a financial institution and we're planning a protocol about access guarding. After a lot of discussion we brake into the question: how to ensure that the accesses (users, passwords, tokens...) are really secure and only the right person has it?

How to ensure that this person won't change the access (password of a service for example) without permission from a superior?

And many, many questions about passwords, accesses...

I don't want to reinvent the wheel, so I'd like to know which protocol is followed by large corporations to protect their access and create elevations for them.

Use a 3rd party system to handle access. Users authenticate to the 3rd party system, then it grants the user access to the target system. There is auditing and other useful controls by implementing this extra layer.

In some tools, the access system changes the password once the user is finished connecting.

The term you are looking for is "Privileged Access Management"


Best option for DDoS protection on DigitalOcean server? I would not like to use CloudFlare since they effectively act as a man in the middle and handle unencrypted data.

Is there a CDN that mitigates the security risks that CloudFlare imposes?

If not, is there at least a DDoS protection service that is considered "secure"?

As @techraf and @josef commented, all DDoS providers have the same challenges:

To effectively identify DDoS traffic, a mitigation provider needs to be connected inside your encryption termination point, or at least be a Man In the Middle.

Your concern regarding CloudFlare is the same concern you should have with them all. If you want DDoS mitigation, you need to let the mitigation provider have access. So start considering what the risks actually are from this. And what you need to do in terms of risk mitigation - perhaps contractual terms with the provider?


How to detect https protocol? As far as I know before sending and receiving data in https a ssl/tls handshake have to be accomplish. Is it reliable to consider every ssl/tls handshakes in port 443 as start of a https connection?
For example to understand how much data is transmitted between client and server via https check for a ssl/tls handshake in port 443 and then consider all session's packet as https.

There are a few things to unpack there, so I'll start with the following points:

Port 443 is usually used for encrypted HTTP (HTTPS) connections. It does not have to be. Web servers can be configured to listen for incoming connections on any port, HTTP messages will be transmitted and received just fine, and the TLS/SSL handshake will complete just fine. 443 is of course the standard though and used the majority of the time.
TLS/SSL is separate from HTTP. It just so happens it's really useful and widely used "on top of" HTTP. TLS/SSL is also used for video chats, messaging, secure FTP connections, etc. Simply, it's a method of securing communications. HTTP is just the most common type of communication secured.
Some of the details of the TLS handshake and how it's established a browsing session will use HTTPS instead of HTTP is explained will in this CloudFlare article and this Medium article. It all starts with the Client Hello message sent to the server. I've included an example of this message below, but it was originally hosted on GitHub.

Client Hello Message
 *** ClientHello, TLSv1.2
    RandomCookie: *** ClientHello, TLSv1.2
    RandomCookie: GMT: -1892413556 bytes = { GMT: -351008774 bytes = { 169, 131, 204, 213, 154, 96, 7, 136, 43, 142, 232, 138, 148, 171, 52, 226, 155, 202, 145, 57, 210, 132, 227, 182, 67, 222, 161, 28, 20 }
    Session ID: 239, 10, 92, 143, 185, {}
    93, Cipher Suites: [Unknown 0x8a:0x8a, TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, Unknown 0xcc:0xa9, Unknown 0xcc:0xa8, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, TLS_RSA_WITH_AES_128_GCM_SHA256, TLS_RSA_WITH_AES_256_GCM_SHA384, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_RSA_WITH_AES_256_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA]
    ………………………………………………

Hope this helps!


How are docker containers affected by CVE-2021-3156? Do docker (web service/server)s run unattended updates? Otherwise, how to do this? I am worried about the recent sudo -s CVE. How are docker containers affected? If I set up an auditing system with remote logging, and have unattended/security updates for docker web apps, is this sufficiently secure?

sudo Is not installed by default on many Linux Docker images. If it is, then you need to either log in to the container and update it or pull a more recent version from the web. I don't know what kind of options a remote hacker has, to  get a command line and execute sudo commands in general but if this option generally exists, then Docker containers are likely insecure and have been for a long time. It seems however that corporate (or for example university) networks where users have sudo or non-sudo access rights are primarily affected. So, where users have terminal access.


How to know if accessing to a VPN service is safe and won't steal my data I want to know if a VPN service is safe or not. If the VPN server itself can catch or sneak peek my data? Or as long as it is a VPN service, then the security is protected by the algorithm itself?

For example, if I use the VPN server to connect to Google services, is it possible for the VPN server to see my data (e.g. username & password of the gmail account)?

If any VPN servers cannot do so to steal clients' data, then I think I can trust any VPN servers. Otherwise, no.

I don't think you can. In theory VPN can be set up as full proxy, so all traffic can be inspected. This is setup setting and usually as a user you can't really "detect" if the VPN provider is doing this or not.

You shouldn't trust ANY VPN service provider.


Which are open problems on policy-based access control system? I'm working on access control system and on analysis tools for reasoning on it. In A.C. system based on policy, think about XACML specifications, the overall behaviour of the system cannot be clearly predict in case of multiple policies, also maybe conflicting.

Thus, my question is, from a developer side or a security system engineer, which are the main features that an analysis tool must have to help policy developing?

There are many example about change-impact analysis, properties verification, ..., but many of them seems to not be used in real application. Which are the real needs of security professionals?

The magic word is RSOP = Resultant Set Of Policy.

Any useful tool tool should show

what the result of all policies are together (as if it was a single policy),
which policies took precedence and why, and
which did not take effect/were overridden by other policies and why,
Any policies which were corrupt or otherwise meaningless.


Is this scheme considered to be text/linguistic steganography? Let say I have the following message:

  Lets meet in front of the hall at morning.

From that I construct this message by applying antonym substitution:

  Lets meet behind the hall at evening.

So "in front of" has been replaced with "behind" and "morning" with "evening". Is this scheme considered as text or linguistic steganography?

This is a substitution, not steganography.  One of the key goals of steganography is deniability.  In information security, deniability is a property which allows denial that information exists or that an action took place.  While the meaning of the message is somewhat disguised in your scheme, the presence of the general message is not.  Steganography is concerned with building a hidden channel which prevents detection of a message being exchanged covertly within an innocent and unrelated communication.

An early simple example might be the book dot cipher where small dots were placed on letters in a book to turn the book itself in to a message.  This primitive approach was not completely hidden, but at a casual glance, it would just look like someone who had a book, it doesn't appear to be any special communication.

To have a linguistic steganography, you would need to encode the information such that a seemingly normal conversation would actually convey some other information.  In your example, it is clear that you are talking about a meeting at some time, so the message, while the details are altered, is not hidden.

A better example of an extremely primitive linguistic steganography would be to have the time of day of a phone call encode some information, or perhaps have values assigned to different items to have for dinner.  If you called to ask when the chicken would be done cooking, that could mean that you needed to meet up later at a drop point.  The actual message is completely concealed by what appears to be a legitimate communication.

Borrowing from Steffen's excellent answer, it seems you may be getting confused by the concept of "synonym substitution" which is a common basic form of linguistic steganography.  With synonym substitution, words are replaced with their synonyms to encode information based on if the word changes or not.  This could either be through a simple binary encoding or a more complex code word system, but the key thing is that the message being sent is unrelated to the message it appears in.  The message that is apparently being sent must be deniable that any hidden meaning exists.

Now, in theory, you could use antonyms instead of synonyms for the substitution used to encode the information, but this runs in to a problem.  Synonym substitution works because the paraphrase will make sense and seem like a reasonable paraphrase or mis-remembering of a known quote.  If you instead start throwing in antonyms it becomes much easier to tell something odd is going on.  Since it looks odd, the deniability is greatly reduced and the message is much more likely to draw the attention of code breakers.  This renders antonym substitution to be a relatively poor means of encoding steganographic information as well.


Dealing with untrusted administrators in a Windows domain I'm providing consultation to a company, where they have domain-joined Windows workstations. One basic requirement is that they don't want anyone (including the an administrator) to be able to login as someone else.

A domain admin is all powerful, and can do a variety of misdeeds, such as changing someone's password and misrepresenting himself as him/her. He can also clear the logs, leaving no trace of his actions.

So, my question is:

Is it possible to force actions like "reset password" to require the approval of more than a single administrator?
Is it possible to audit actions in way that the domain admin cannot tamper with them?
Do you suggest any other approach to deal with environments with untrusted admins?

The answer is simple: do not allow Domain Admins. Give access to specific functions to specific people who are in the job of administration. The "Domain Admin" group should be empty with alerts when a user is added to this group.

In small teams, this might be a little tricky, but you can include people outside of the IT admin staff for oversight, and you can create a scheme to make sure staff only gets a part of the privileges necessary to prevent tampering.

Give password management to a user who can only log into a single machine, and audit if other users log into that machine.
Allow log access to a person to someone who cannot change user accounts
This is the principle of "Least Privilege" at work, which is how you deal with any level of 'distrust'


SSL session is at layer 3 or layer 4 An SSL session is established between two nodes (via ip addresses,layer 3) or between applications ( layer 4) ?
Thanks

IP, and TCP/IP pre-dates the OSI model. Layers 1-4 of OSI almost map to the network and TCP/IP stack (which TLS sits on top of) but if you keep trying to explain one in terms of the other you're going to become lost; there are at least 3 session layers in a HTTP/2 application, usually 4 and sometimes more.


How server knows about the client_write_key to decrypt the client message? I have a question regarding the TLS handshake. As of my reading I came to know that master_secret will be derived from pre_master_secret shared by client as follows:

master_secret = PRF(pre_master_secret, "master secret", lientHello.random + ServerHello.random)
From this master_secret the below session keys are derived.
On client side:

client_write_MAC_secret[SecurityParameters.hash_size]
client_write_key[SecurityParameters.key_material_length]
client_write_IV[SecurityParameters.IV_size]

On server side:

server_write_MAC_secret[SecurityParameters.hash_size]
server_write_key[SecurityParameters.key_material_length]
server_write_IV[SecurityParameters.IV_size]

Wwhen these session keys are generated separately on the client and the server and never exchanged and transmitted between them, how does the server decrypt the client's encrypted message and vice-versa?

Or all the 6 session keys are created on both client and server individually and hope they are similar. If this is true then both the client and the server can decrypt each others encrypted messages.

Look at RFC 5246 Section 6.3. On both sides, bytes are generated using the PRF from the same arguments, so the generated bytes are the same. Those generated bytes are used the following way: The first "mac_key_length" bytes (e.g. 20 bytes) are the client's MAC key and the next "mac_key_length" are the server's. Then the next "enc_key_length" (e.g. 16 bytes) are the client's cipher (e.g. AEs) key and the next are the server's, etc.

Each sides knows whether it's the client or the server, so they choose the right MAC/key/IV when reading and the other MAC/key/IV when writing.


Is it fundamentally possible to develop a (provenly) transparent computing system? I recently asked a question regarding security obstacles of online voting via a web service, and one of the primary obstacles to doing this is the difficulty of proving that the program processing incoming vote data is the actual open source code shown to interested parties for verification of non malicious / unfair vote counting.

We can make the software for vote verification open source, but proving that the program actually running on the receiving end is code that should be used, running without malicious alteration seems like an interesting challenge.

So my question is: Is it fundamentally possible to provide proven (observably valid without doubt) processing information at the core of a security computing system so that expert observers / analyzers can know without doubt that specific, non-altered logic (the correct open source software) is being used to recieve, compute, and store information as promised?

More simply put, can we (fundamentally) somehow prove to people that we're performing the computational logic that we say we are? Prove to expert observers that we are receiving, processing, and storing data (for example, votes) via specificied logic, without the possibility for malicious influence?

Furthermore, if so, and this might be a difficult question, (fundamentally) can this be done in a way as to preserve the anonymity of the actual data being verified?

To be clear, such a feat might be an achievement of the utmost genius and involve writing new kernels, and and special OS - I'm not asking of the viability, I'm only asking whether it's fundamentally possible from an information security standpoint.

With existing hardware, no, it is fundamentally impossible to demonstrate that the code you run is indeed the code you should run and nothing else. This is easily seen with regards to confidentiality: imagine, for instance, that you run a vote-counting application; voters connect to it and send their vote. The "honest" application does not leak individual vote data, though it sees all votes and knows what each voter voted. However, from the outside, you see only the network packets that come and go, so you cannot tell whether some other part of the system is inspecting the RAM contents at the same time or not. In practice, a malicious system maintainer would run the application in a virtual machine and take VM snapshots whenever a new voter connects. By virtue of the VM emulating a "true" machine, this kind of malicious activity cannot be reliably dismissed.

Some things can still be done to try to obtain some guarantees that the code that runs is the expected one:

The hardware could be set up in a physically secured room, under audit, with access procedures that require at least two human operators, and video cameras recording the whole thing. This is commonly done for root certificate authorities: that kind of machine is on offline PC, kept in a cage in a secure room, and used occasionally (say, on a monthly basis) to issue a few certificates to intermediate CA, and to make new CRL. The whole process aims at ensuring that, indeed, the machine will do only what it is supposed to do; and this is all procedures, without special software.
For some operations, there are possible cryptographic protocols. For instance, for voting systems, one can use homomorphic encryption, allowing the central system to tally the votes without being given access to the actual vote contents. Since voters submit only encrypted votes, they must demonstrate that the contents are "valid" (they encrypted a 0 or a 1, but not another value): this is done with zero-knowledge proofs. Note the nuance here: the voter is not proving that he is using a specific, open-source code that encrypts his vote; but he proves that what he ultimately sends to the tally machine is indeed the encryption of a valid vote, regardless of how he actually computed it.


How do systems protect against a stolen code-signing certificate after the certificate expires? Imagine this scenario:

1st December 2014 - a certificate is stolen and used to sign malware with 2014-12-01 timestamp.
15th December 2014 - the certificate is revoked. Malware will be prevented from running by systems that check CRLs.
31st December 2014 - certificate expires and is removed from CRLs as suggested by this answer - "certificates which are expired are removed from the CRL".
1st January 2015 - malware can now be run again, as the signing timestamp indicates that the certificate was valid at the time of signing, and this is what systems use when determining whether to trust a signature.

Is this possible, or am I misunderstanding something about the way code signing works? Am I making an assumption in step 4? Sources such as the Java documentation seem to imply that this is how it works - "Because signing certificates typically expire annually, this caused customers significant problems by forcing them to re-sign deployed JAR files annually. Starting in J2SE 5.0, jarsigner can generate signatures that include a timestamp, thus enabling systems/deployer (including Java Plug-in) to check whether the JAR file was signed while the signing certificate was still valid."

This is why Microsoft recommends to never remove expired code signing certs from CRLs. An alternative scenario: attacker signs their malware before cert expiry. If they can remain undiscovered past cert expiry, then the cert won't get added to the CRL even on discovery, and their malware will never get blocked. Thus the revocation status of code signing certs must be tracked forever.
From Microsoft's Code Signing Best Practices document:

In most PKI deployments, only certificates that have not yet expired are placed on the CRL. This means that when a revoked certificate expires, it is eventually removed from the CRL. However, timestamping allows Authenticode signatures to remain valid indefinitely. As a result, revoked code-signing certificates should not be removed from the CRL. This paper recommends always revoking compromised certificates that were used to sign publicly released software and maintaining these entries in the CRL indefinitely.
Microsoft Certificate Server enables administrators to configure the CA to keep all revoked certificates in the CRL. However, the CA does not distinguish between code-signing certificates and other certificates. For this reason, administrators should dedicate a CA for the sole purpose of handling code-signing production certificates.

So to answer your question - yes, the malware can run again if the CRL for code signing certs isn't managed properly.


How does arbitary code execution work? I'm unable to understand how arbitrary code execution vulnerabilities are supposed to work.

Wikipedia mentions:

  Arbitrary code execution is commonly achieved through control over the instruction pointer of a running process.

Say, the vulnerability is being triggered by some maliciously crafted file that said process is reading. How could it modify the instruction pointer, or, otherwise, corrupt the internal state of the application so as to cause it to execute the attacker's code?

Also, given that modern OSes implement DEP and ASLR, how is this even feasible? The data loaded from the application would not even be executable, and additionally, it's also difficult to determine the offset of the shellcode/payload.

Brownie points for showing a small snippet of code that would be vulnerable to such an exploit.

Each vulnerability has a specific cause, which in turn leads to ways of exploiting the vulnerability. It is hard to understand how one can exploit something abstract and gain some abstract results, but it is way easier to understand when illustrated with examples. The simplest would be the classical stack-based buffer overflow:

void f(const char *str) {
  char buf[10];
  strcpy(buf, str);
}

This is a primitive example that should be sufficient to demonstrate the issue. Suppose the str argument points to a NULL-terminated string longer than the 10 chars allocated for the variable it is being copied into. What will happen? strcpy() will blindly copy the data over the end of the buffer, overwriting whatever was there. But what exactly is there?

On x86, for example, the buf variable would be allocated on the stack. The stack is also used to save the return address when a CALL instruction is executed. So the (simplified) stack layout would look like this (addresses are increasing top to bottom):

...
buf[0..3]
buf[4..7]
buf[8..9]
return address
...

So, by supplying an overly long string via the str argument, we would be able to overwrite the return address from f(). If the attacker is able to control the string, then he can control where the control flow will go after f() returns. This may occur when parsing a specially crafted file, for example.

The next thing would be to direct the control to a JMP ESP instruction or similar in effect, causing code from the stack to be executed. This "direct" code execution is prevented by DEP.

Of course, the example above doesn't include bypassing any of modern mitigations (stack canaries, SafeSEH, DEP). This does not mean it is globally impossible, but it may be impossible in certain cases. Bypassing DEP usually involves Return-oriented programming -- instead of code itself, specially crafted data is placed on the stack, which utilises fragments of already existing functions in the process image (called gadgets) to execute code. This, in turn, is mitigated by ASLR, making the gadget addresses somewhat unpredictable. There are techniques of bypassing ASLR as well.

If you would like to get your hands on exploiting real-life programs, I would suggest corelanc0d3r's tutorials as a starting point.

EDIT: Replaced the offending part.


Keeping user files secure while allowing a web-application to use the files Short background

I am currently in the process of designing a web-application where the user uploads some files to the server and then asks the server to do some calculations based on these files (task may be queued if the current workload is high). Then the server stores the result and makes it available for the user to view.

These files may contain private and/or sensitive data and therefore I decided to look into ways to keep these files secure on the server side.

I have done some research into this topic but not found the solution that I am looking for. I do have a general idea for the design, but I feel it is flawed and that I might be reinventing the wheel (lacking experience in this field).

I will start with the basic requirements, then present my idea and end with the questions i have.

Security requirements

System must encrypt the files before storing on the file system
System administrators etc must not be able to decrypt the files on
their own (next requirement takes priority over this requirement)
System must be able to decrypt the files only if user
provides authentication
System must support multiple simultaneous users with each user able to only authenticate decryption the files uploaded by that user.

Current idea

Storing the files in a way that decryption is possible only for the user seems quite straight forward. Currently I am thinking of the following workflow:

User creates a public/private key pair (with some 3rd party tools)
User uploads the public key to the system
User uploads file (file stays in memory for now)
System generates shared key for encrypting the file
System encrypts the file with the shared key
System stores the file
System encrypts the shared key with the public key
System stores the encrypted shared key

I believe this approach is quite common and does not have any serious draw-backs.

Now the problematic part. Since I want the user to be able to allow the system to decrypt the file in some situations then this is the only workflow I came up with:

User starts a task that requires an encrypted file
User uploads the private key (stays only in memory)
System decrypts the shared key (stays only in memory)
System deletes the private key from memory
System decrypts the file into memory
System deletes the decrypted shared key from memory
System completes the task
System deletes the decrypted file from memory
System stores the task result

Questions

While I do believe that this approach would be functional, I am still worried about a couple of things:

I am not sure if uploading a private key as a regular file can even be considered as a viable option? - If i'm not mistaken, then this at least goes against the usual norms.
Can the private key be transferred securely over the internet? - I am inclined to believe that it can, however I have not jet looked into how exactly.
Even if the encrypted file (or the private key) is only held in memory for the minimum time needed, would it still be a security risk? - I feel that it is still a risk, but not a serious one.
Is this already a solved problem? - If so than I was unable to find the solutions

As a final remark I would like to add that I am fully aware that any such system would require trust from the users. Mainly I would like to know if this is achievable at all, is my idea viable and is there a better/alternative way?

For part two, you can do sensibly better:

(The session between User and System is encrypted)
User starts a task that requires an encrypted file
System sends tne encrypted shared key
User locally decrypts the shared key
User sends the decrypted shared key (stays only in memory)
System decrypts the file into memory
System deletes the decrypted shared key from memory
System completes the task
System deletes the decrypted file from memory
System stores the task result

You should ensure the memory of the routine that performs the task is not accessible by other threads on the system's service, if you happen to serve multiple clients on the same system, using compartmentalisation techniques like COWL (not sure about its implementation status) or maybe Capsicum.

I'm thinking strongly of secure multi-party computation and homomorphic encryption when reading your problem. I'm not expert so won't dwell on this, though. There might be ways, depending on what you need to compute, to perform the computation without actually having to decrypt the files. This might also be achieved by having clients compute and upload encrypted properties about the files rather than the files themselves.

There are quite possibly tons of other designs, and hopefully someone will point out a better approach.