Showing posts with label web. Show all posts
Showing posts with label web. Show all posts

Friday, October 4, 2019

Web Security Issues

No Authentication & Authorization

Authentication is knowing who an entity is, while authorization is knowing what a given entity can do. APIs should have proper authentication and authorization in place.

What is the solution?

  1. We added authentication and authorization for most APIs.

XSS (Cross-site scripting)

Qualys scan result can help on XSS detection.
With that being side, any sensitive data in HTML body or Javascript is not allowed.

What is the solution?

  1. Always encode customer input to avoid display direct HTML/JS
  2. Move the data from visible JS object to browser memory
  3. Use a framework which takes care of XSS.

CSV Injection

CSV Injection, also known as Formula Injection, occurs when websites embed untrusted input inside CSV files. When a spreadsheet program such as Microsoft Excel or LibreOffice Calc is used to open a CSV, any cells starting with '=' will be interpreted by the software as a formula.

What is the solution?

To remediate it, ensure that no cells begin with any of the following characters:
Equals to ("=")
Plus ("+")
Minus ("-")
At ("@")
This should apply to all download CSV files.

No Input Validation

Input validation on backend APIs is so critical to application security.

What is the solution?

Anything that our application receives from untrusted sources must be filtered, preferably according to a whitelist.
Input validation
Input filtering
Input encoding

Sensitive data exposure

Sensitive data should be encrypted at all times, including in transit and at rest. Also, the logging file should not print any sensitive data.

What is the solution?

  1. In transit: Use HTTPS. Do not accept anything over non-HTTPS connections. Have the secure and HttpOnly flag on cookies.
  2. In storage: if you have sensitive data that you actually do need, store it encrypted and make sure all passwords are hashed.

Security misconfiguration

Do not widely open your environments to the internet access, which gives Hacker chance to explore vulnerabilities.

What is the solution?

  1. Do NOT widely open environment to outside. Use IP whitelist for access control
  2. Perform regular host/container vulnerability scan
  3. Perform regular web application vulnerability scan using Qualys alike tool

DoS or DDoS

Denial of service attack is crucial.

What is the solution?

  1. Add rate limit control to the application 

CORS (cross-origin resource sharing)

The most common and problematic security issue when implementing CORS is the failure to validate/whitelist requestors. Too often developers set the value for Access-Control-Allow-Origin to ‘*’. Unfortunately, this is the default. This allows any domain on the web to access that site’s resources.

What is the solution?

  1. Should we Set Access-Control-Allow-Origin to * ?
  2. What About Access-Control-Allow-Methods?

SSL Certificate Uses Weak Signature

The integrity of the signature hash algorithm used in signing a certificate is a critical element in the security of the certificate. Weaknesses in hash algorithms can lead to situations in which attackers can obtain fraudulent certificates. The MD5 signature has long been considered outdated by cryptographic specialists. SHA-1 is outdated and has been phased out by several sources - including Microsoft, Google, and Mozilla as of January 1, 2016.

What is the solution?

  1. Use SHA256 algorithm

Wednesday, October 11, 2017

Domain registrar list


I use GoDaddy to host my domains, but renew price is $19.99 every year, so I am looking for some cheaper alternative for my domains' registrar. Here is the list

namecheap.com
enom.com
hostgator.com
dreamhost.com
name.com
1and1.com
gandi.com
fabulous.com
google
amazon

I will try to transfer to namecheap.com as its renew price is under $10 for .com domain. As its name indicates, it is pretty cheap comparing to other registrars. They also have promo code available in a monthly update. https://www.namecheap.com/promos/coupons.aspx

Tuesday, February 7, 2017

Web Communication/Message

MessageEvent: This interface is for message events used in WebSocket, WebRTC RTCDataChannel, server-sent events, cross-document messaging, channel messaging, and broadcast channels.

1. EventSource: This interface is used to receive server-sent events. It connects to a server over HTTP and receives events in text/event-stream format without closing the connection.

2. WebSocket: This interface is used to enable Web applications to maintain bidirectional communications with server-side processes

3. window.postMessage(message, targetOrigin, transfer): This method is used to post message to the given window.
  • Message can be structured objects, e.g. nested objects and arrays, can contain JavaScript values (strings, numbers, Date objects, etc), and can contain certain data objects such as File Blob, FileList, and ArrayBuffer objects.
  • If the origin of the target window doesn't match the given origin, the message is discarded, to avoid information leakage. To send the message to the target regardless of origin, set the target origin to "*". To restrict the message to same-origin targets only, without needing to explicitly state the origin, set the target origin to "/".
  • Objects listed in transfer are transferred, not just cloned, meaning that they are no longer usable on the sending side.
4. MessageChannel: The interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties. This will enable independent pieces of code (e.g. running in different browsing contexts) to communicate directly.
  • MessagePort: MessagePort objects are transferable objects, Each channel has two message ports. Data sent through one port is received by the other port, and vice versa.
5. BroadcastChannel: This interface represents a named channel that any browsing context of a given origin can subscribe to. It allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin.

Friday, January 27, 2017

Time to change

In year 2012, when I joined Moxtra to work on Front-end Web app, I didn't know anything about Javascript, CSS or HTML5. I was using Java/J2EE while in Cisco. At that time, I googled a lot and made the following choice for Moxtra web app architecture in a short period of time.
When look back, the selections were ok at that time. However, Web front-end evolved rapidly every few months, and in past 4.5 years, there are many new ideas, frameworks, libraries, and tools created for the community while major browsers are upgraded in a rapid pace to fully supporting ES5 and partially supporting ES6. (http://caniuse.com/)

Today I read a blog https://risingstars2016.js.org/ which listed popular front-end projects/libraries in 2016. I am totally terrified to see so many new things happening.

Popular lib/frameworks
Node.js Frameworks -> Express, Sails, Loopback, Restify
React Boilerplates -> Create React App, React boilerplate
Mobile -> React Native
Transpilers -> TypeScript, Babel
Build Tools -> Webpack, Gulp
Testing Framework -> AVA, Jest
SSG (Static Site Generators) -> Hexo, Gatsby

Most popular projects on Github
Vue.js
React
Yarn
Angular 2
Electron
Create React App
React Native
Redux
Boostrap
D3

Time to change:
ES5 -> ES6
Backbone -> Vue.js/React
Requirejs -> Webpack
Grunt -> Gulp/Webpack
Sublime -> Atom/Visual Studio Code
Mocha/Jasmine -> AVA/Jest
NPM -> Yarn

Friday, August 14, 2015

Baseline for front-end developers

http://rmurphey.com/blog/2012/04/12/a-baseline-for-front-end-developers/
Javascript
Git
Modularity, dependency management, and production builds
In-Browser Developer Tools
The command line
Client-side templating
CSS preprocessors
Testing (Jasmine/Mocha)
Process automation (rake/make/grunt/etc.)
MDN (The fine manual)

http://rmurphey.com/blog/2015/03/23/a-baseline-for-front-end-developers-2015/
Javascript (ES6, BabelJS)
Modules & Build Tools (AMD, requirejs, browserify, systemjs)
Testing (Karma, Intern)
Process Automation (Grunt, Gulp, Yeoman, Broccoli)
Code quality (ESlint, JSCS)
Git
Client-Side Templating
Node (MEAN, express)